\hypertarget{lio__console_8c_source}{}\doxysection{lio\+\_\+console.\+c}
\label{lio__console_8c_source}\index{dev/liquidio/base/lio\_console.c@{dev/liquidio/base/lio\_console.c}}
\mbox{\hyperlink{lio__console_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00001}00001 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00002}00002 \textcolor{comment}{ *   BSD LICENSE}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00003}00003 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00004}00004 \textcolor{comment}{ *   Copyright(c) 2017 Cavium, Inc.. All rights reserved.}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00005}00005 \textcolor{comment}{ *   All rights reserved.}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00006}00006 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00007}00007 \textcolor{comment}{ *   Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00008}00008 \textcolor{comment}{ *   modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00009}00009 \textcolor{comment}{ *   are met:}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00010}00010 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00011}00011 \textcolor{comment}{ *     * Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00012}00012 \textcolor{comment}{ *       notice, this list of conditions and the following disclaimer.}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00013}00013 \textcolor{comment}{ *     * Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00014}00014 \textcolor{comment}{ *       notice, this list of conditions and the following disclaimer in}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00015}00015 \textcolor{comment}{ *       the documentation and/or other materials provided with the}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00016}00016 \textcolor{comment}{ *       distribution.}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00017}00017 \textcolor{comment}{ *     * Neither the name of Cavium, Inc. nor the names of its}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00018}00018 \textcolor{comment}{ *       contributors may be used to endorse or promote products derived}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00019}00019 \textcolor{comment}{ *       from this software without specific prior written permission.}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00020}00020 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00021}00021 \textcolor{comment}{ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00022}00022 \textcolor{comment}{ *   "{}AS IS"{} AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00023}00023 \textcolor{comment}{ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00024}00024 \textcolor{comment}{ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00025}00025 \textcolor{comment}{ *   OWNER(S) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00026}00026 \textcolor{comment}{ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00027}00027 \textcolor{comment}{ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00028}00028 \textcolor{comment}{ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00029}00029 \textcolor{comment}{ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00030}00030 \textcolor{comment}{ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00031}00031 \textcolor{comment}{ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00032}00032 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00033}00033 \textcolor{comment}{/*\$FreeBSD\$*/}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00034}00034 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00035}00035 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00036}00036 \textcolor{comment}{ * @file lio\_console.c}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00037}00037 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00038}00038 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00039}00039 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{lio__bsd_8h}{lio\_bsd.h}}"{}}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00040}00040 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{lio__common_8h}{lio\_common.h}}"{}}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00041}00041 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{lio__droq_8h}{lio\_droq.h}}"{}}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00042}00042 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{lio__iq_8h}{lio\_iq.h}}"{}}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00043}00043 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{lio__response__manager_8h}{lio\_response\_manager.h}}"{}}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00044}00044 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{lio__device_8h}{lio\_device.h}}"{}}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00045}00045 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{lio__image_8h}{lio\_image.h}}"{}}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00046}00046 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{lio__mem__ops_8h}{lio\_mem\_ops.h}}"{}}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00047}00047 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{lio__main_8h}{lio\_main.h}}"{}}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00048}00048 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00049}00049 \textcolor{keyword}{static} \textcolor{keywordtype}{void}     \mbox{\hyperlink{lio__console_8c_a989c365b922d8f961720c3ec9ecae6e0}{lio\_get\_uboot\_version}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structocteon__device}{octeon\_device}} *oct);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00050}00050 \textcolor{keyword}{static} \textcolor{keywordtype}{void}     \mbox{\hyperlink{lio__console_8c_a954d8088823e16bbc291c4855a1b7310}{lio\_remote\_lock}}(\textcolor{keywordtype}{void});}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00051}00051 \textcolor{keyword}{static} \textcolor{keywordtype}{void}     \mbox{\hyperlink{lio__console_8c_a10aa47e840712fb04f96a2663b53b727}{lio\_remote\_unlock}}(\textcolor{keywordtype}{void});}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00052}00052 \textcolor{keyword}{static} uint64\_t \mbox{\hyperlink{lio__console_8c_a82da54f95d48fc497439779e0211409f}{cvmx\_bootmem\_phy\_named\_block\_find}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structocteon__device}{octeon\_device}} *oct,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00053}00053                                                   \textcolor{keyword}{const} \textcolor{keywordtype}{char} *name,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00054}00054                                                   uint32\_t flags);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00055}00055 \textcolor{keyword}{static} \textcolor{keywordtype}{int}      \mbox{\hyperlink{lio__console_8c_aaa6df0f3b5c13ba5909838a343de2a8b}{lio\_console\_read}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structocteon__device}{octeon\_device}} *oct,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00056}00056                                  uint32\_t console\_num, \textcolor{keywordtype}{char} *buffer,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00057}00057                                  uint32\_t buf\_size);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00058}00058 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00059}\mbox{\hyperlink{lio__console_8c_a7ad1a62c1c012e0acd975d8f22c372fe}{00059}} \textcolor{preprocessor}{\#define CAST\_ULL(v)     ((unsigned long long)(v))}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00060}00060 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00061}\mbox{\hyperlink{lio__console_8c_aac0f29a3c0441968f2813a23d11b12a3}{00061}} \textcolor{preprocessor}{\#define LIO\_BOOTLOADER\_PCI\_READ\_BUFFER\_DATA\_ADDR        0x0006c008}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00062}\mbox{\hyperlink{lio__console_8c_a51cc6ba972085cad8b826e913284d7c1}{00062}} \textcolor{preprocessor}{\#define LIO\_BOOTLOADER\_PCI\_READ\_BUFFER\_LEN\_ADDR         0x0006c004}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00063}\mbox{\hyperlink{lio__console_8c_a0b4ca8b680b72ad593f839619b96aa92}{00063}} \textcolor{preprocessor}{\#define LIO\_BOOTLOADER\_PCI\_READ\_BUFFER\_OWNER\_ADDR       0x0006c000}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00064}\mbox{\hyperlink{lio__console_8c_a58dfca4fc61f3b9894f8d075cc291601}{00064}} \textcolor{preprocessor}{\#define LIO\_BOOTLOADER\_PCI\_READ\_DESC\_ADDR               0x0006c100}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00065}\mbox{\hyperlink{lio__console_8c_a175b9bdf90adddf16370a8b3961a4fb1}{00065}} \textcolor{preprocessor}{\#define LIO\_BOOTLOADER\_PCI\_WRITE\_BUFFER\_STR\_LEN         248}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00066}00066 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00067}\mbox{\hyperlink{lio__console_8c_a11c5360803c1ce87c2a999cd811f1f07}{00067}} \textcolor{preprocessor}{\#define LIO\_PCI\_IO\_BUF\_OWNER\_OCTEON     0x00000001}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00068}\mbox{\hyperlink{lio__console_8c_a1c4abb9ed40bfc0410a5efc2dec4e428}{00068}} \textcolor{preprocessor}{\#define LIO\_PCI\_IO\_BUF\_OWNER\_HOST       0x00000002}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00069}00069 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00070}\mbox{\hyperlink{lio__console_8c_a061f25d7ebfb922c46ce2564ab4e1a7d}{00070}} \textcolor{preprocessor}{\#define LIO\_PCI\_CONSOLE\_BLOCK\_NAME      "{}\_\_pci\_console"{}}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00071}\mbox{\hyperlink{lio__console_8c_a9ba54ebd0ba8b663917ad3320f829eef}{00071}} \textcolor{preprocessor}{\#define LIO\_CONSOLE\_POLL\_INTERVAL\_MS    100     }\textcolor{comment}{/* 10 times per second */}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00072}00072 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00073}00073 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00074}00074 \textcolor{comment}{ * First three members of cvmx\_bootmem\_desc are left in original positions}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00075}00075 \textcolor{comment}{ * for backwards compatibility. Assumes big endian target}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00076}00076 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00077}\mbox{\hyperlink{structcvmx__bootmem__desc}{00077}} \textcolor{keyword}{struct }\mbox{\hyperlink{structcvmx__bootmem__desc}{cvmx\_bootmem\_desc}} \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00078}00078         \textcolor{comment}{/* lock to control access to list */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00079}\mbox{\hyperlink{structcvmx__bootmem__desc_af3e336ffebae1459a918691c1738b047}{00079}}         uint32\_t        \mbox{\hyperlink{structcvmx__bootmem__desc_af3e336ffebae1459a918691c1738b047}{lock}};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00080}00080 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00081}00081         \textcolor{comment}{/* flags for indicating various conditions */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00082}\mbox{\hyperlink{structcvmx__bootmem__desc_a3b7be847fd2571ee61a2c79b785f8e69}{00082}}         uint32\_t        \mbox{\hyperlink{structcvmx__bootmem__desc_a3b7be847fd2571ee61a2c79b785f8e69}{flags}};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00083}00083 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00084}\mbox{\hyperlink{structcvmx__bootmem__desc_aeedeeb39a83b6dfebbebe6394df5ec0e}{00084}}         uint64\_t        \mbox{\hyperlink{structcvmx__bootmem__desc_aeedeeb39a83b6dfebbebe6394df5ec0e}{head\_addr}};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00085}00085 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00086}00086         \textcolor{comment}{/* incremented changed when incompatible changes made */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00087}\mbox{\hyperlink{structcvmx__bootmem__desc_a404136ab6312555962c716c3778c6283}{00087}}         uint32\_t        \mbox{\hyperlink{structcvmx__bootmem__desc_a404136ab6312555962c716c3778c6283}{major\_version}};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00088}00088 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00089}00089         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00090}00090 \textcolor{comment}{         * incremented changed when compatible changes made, reset to zero}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00091}00091 \textcolor{comment}{         * when major incremented}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00092}00092 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00093}\mbox{\hyperlink{structcvmx__bootmem__desc_a738705d5b3b0820ed49d4027cf4b3e13}{00093}}         uint32\_t        \mbox{\hyperlink{structcvmx__bootmem__desc_a738705d5b3b0820ed49d4027cf4b3e13}{minor\_version}};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00094}00094 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00095}\mbox{\hyperlink{structcvmx__bootmem__desc_a5e3319aa6c525ff9740b26205619905f}{00095}}         uint64\_t        \mbox{\hyperlink{structcvmx__bootmem__desc_a5e3319aa6c525ff9740b26205619905f}{app\_data\_addr}};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00096}\mbox{\hyperlink{structcvmx__bootmem__desc_a34c6caa950ea76ddf4db8df1ca9992c5}{00096}}         uint64\_t        \mbox{\hyperlink{structcvmx__bootmem__desc_a34c6caa950ea76ddf4db8df1ca9992c5}{app\_data\_size}};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00097}00097 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00098}00098         \textcolor{comment}{/* number of elements in named blocks array */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00099}\mbox{\hyperlink{structcvmx__bootmem__desc_a9d98bdff13a4ab2bf3d9f0f37eff7236}{00099}}         uint32\_t        \mbox{\hyperlink{structcvmx__bootmem__desc_a9d98bdff13a4ab2bf3d9f0f37eff7236}{nb\_num\_blocks}};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00100}00100 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00101}00101         \textcolor{comment}{/* length of name array in bootmem blocks */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00102}\mbox{\hyperlink{structcvmx__bootmem__desc_ab04d893df8b72bbacd1eb329be56cce6}{00102}}         uint32\_t        \mbox{\hyperlink{structcvmx__bootmem__desc_ab04d893df8b72bbacd1eb329be56cce6}{named\_block\_name\_len}};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00103}00103 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00104}00104         \textcolor{comment}{/* address of named memory block descriptors */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00105}\mbox{\hyperlink{structcvmx__bootmem__desc_a846e0f494d36fa47025ad070720c9844}{00105}}         uint64\_t        \mbox{\hyperlink{structcvmx__bootmem__desc_a846e0f494d36fa47025ad070720c9844}{named\_block\_array\_addr}};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00106}00106 \};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00107}00107 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00108}00108 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00109}00109 \textcolor{comment}{ * Structure that defines a single console.}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00110}00110 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00111}00111 \textcolor{comment}{ * Note: when read\_index == write\_index, the buffer is empty. The actual usable}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00112}00112 \textcolor{comment}{ * size of each console is console\_buf\_size -\/1;}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00113}00113 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00114}\mbox{\hyperlink{structlio__pci__console}{00114}} \textcolor{keyword}{struct }\mbox{\hyperlink{structlio__pci__console}{lio\_pci\_console}} \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00115}\mbox{\hyperlink{structlio__pci__console_ab67cff042450f8b1663ecdf193e96e3a}{00115}}         uint64\_t        \mbox{\hyperlink{structlio__pci__console_ab67cff042450f8b1663ecdf193e96e3a}{input\_base\_addr}};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00116}\mbox{\hyperlink{structlio__pci__console_a09617ced5d6a6c03f94a6770127ddce3}{00116}}         uint32\_t        \mbox{\hyperlink{structlio__pci__console_a09617ced5d6a6c03f94a6770127ddce3}{input\_read\_index}};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00117}\mbox{\hyperlink{structlio__pci__console_a1439b0375e23823b633b28a2d31c9150}{00117}}         uint32\_t        \mbox{\hyperlink{structlio__pci__console_a1439b0375e23823b633b28a2d31c9150}{input\_write\_index}};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00118}\mbox{\hyperlink{structlio__pci__console_a0594dbd9fe92443029a331c3754de25f}{00118}}         uint64\_t        \mbox{\hyperlink{structlio__pci__console_a0594dbd9fe92443029a331c3754de25f}{output\_base\_addr}};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00119}\mbox{\hyperlink{structlio__pci__console_a64bfb72a37b9417019f07206c66132ae}{00119}}         uint32\_t        \mbox{\hyperlink{structlio__pci__console_a64bfb72a37b9417019f07206c66132ae}{output\_read\_index}};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00120}\mbox{\hyperlink{structlio__pci__console_ae123fd90cbe39b7a7446d0aad49073cb}{00120}}         uint32\_t        \mbox{\hyperlink{structlio__pci__console_ae123fd90cbe39b7a7446d0aad49073cb}{output\_write\_index}};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00121}\mbox{\hyperlink{structlio__pci__console_a3ba5cb14968f111d912b148b7169d224}{00121}}         uint32\_t        \mbox{\hyperlink{structlio__pci__console_a3ba5cb14968f111d912b148b7169d224}{lock}};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00122}\mbox{\hyperlink{structlio__pci__console_a0ec7984e09d2b5c1ad831f55c12d6079}{00122}}         uint32\_t        \mbox{\hyperlink{structlio__pci__console_a0ec7984e09d2b5c1ad831f55c12d6079}{buf\_size}};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00123}00123 \};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00124}00124 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00125}00125 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00126}00126 \textcolor{comment}{ * This is the main container structure that contains all the information}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00127}00127 \textcolor{comment}{ * about all PCI consoles.  The address of this structure is passed to}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00128}00128 \textcolor{comment}{ * various routines that operation on PCI consoles.}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00129}00129 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00130}\mbox{\hyperlink{structlio__pci__console__desc}{00130}} \textcolor{keyword}{struct }\mbox{\hyperlink{structlio__pci__console__desc}{lio\_pci\_console\_desc}} \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00131}\mbox{\hyperlink{structlio__pci__console__desc_a31354bc7271ef9f70a538ea4cc81688e}{00131}}         uint32\_t        \mbox{\hyperlink{structlio__pci__console__desc_a31354bc7271ef9f70a538ea4cc81688e}{major\_version}};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00132}\mbox{\hyperlink{structlio__pci__console__desc_a7c9102cabab2a3364c11a1b298c7e179}{00132}}         uint32\_t        \mbox{\hyperlink{structlio__pci__console__desc_a7c9102cabab2a3364c11a1b298c7e179}{minor\_version}};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00133}\mbox{\hyperlink{structlio__pci__console__desc_a1e63b5cfa496a8371e4d4da8c18a0196}{00133}}         uint32\_t        \mbox{\hyperlink{structlio__pci__console__desc_a1e63b5cfa496a8371e4d4da8c18a0196}{lock}};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00134}\mbox{\hyperlink{structlio__pci__console__desc_ab1bc3d88f762d53f3b5434b21179c82a}{00134}}         uint32\_t        \mbox{\hyperlink{structlio__pci__console__desc_ab1bc3d88f762d53f3b5434b21179c82a}{flags}};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00135}\mbox{\hyperlink{structlio__pci__console__desc_abc0622be648ac6b8d648589364da2915}{00135}}         uint32\_t        \mbox{\hyperlink{structlio__pci__console__desc_abc0622be648ac6b8d648589364da2915}{num\_consoles}};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00136}\mbox{\hyperlink{structlio__pci__console__desc_ad7ce90cdb0957d64a788b695d74ca660}{00136}}         uint32\_t        \mbox{\hyperlink{structlio__pci__console__desc_ad7ce90cdb0957d64a788b695d74ca660}{pad}};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00137}00137         \textcolor{comment}{/* must be 64 bit aligned here... */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00138}00138         \textcolor{comment}{/* Array of addresses of octeon\_pci\_console structures */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00139}\mbox{\hyperlink{structlio__pci__console__desc_aa41c0ce23f1d46f79f9bcc1e64539d70}{00139}}         uint64\_t        \mbox{\hyperlink{structlio__pci__console__desc_aa41c0ce23f1d46f79f9bcc1e64539d70}{console\_addr\_array}}[1];}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00140}00140         \textcolor{comment}{/* Implicit storage for console\_addr\_array */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00141}00141 \};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00142}00142 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00143}00143 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00144}00144 \textcolor{comment}{ * This macro returns the size of a member of a structure. Logically it is}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00145}00145 \textcolor{comment}{ * the same as "{}sizeof(s::field)"{} in C++, but C lacks the "{}::"{} operator.}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00146}00146 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00147}\mbox{\hyperlink{lio__console_8c_a702b0dd1ac75146dd5ef8d96a5150588}{00147}} \textcolor{preprocessor}{\#define SIZEOF\_FIELD(s, field) sizeof(((s *)NULL)-\/>field)}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00148}00148 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00149}00149 \textcolor{comment}{ * This function is the implementation of the get macros defined}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00150}00150 \textcolor{comment}{ * for individual structure members. The argument are generated}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00151}00151 \textcolor{comment}{ * by the macros inorder to read only the needed memory.}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00152}00152 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00153}00153 \textcolor{comment}{ * @param oct    Pointer to current octeon device}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00154}00154 \textcolor{comment}{ * @param base   64bit physical address of the complete structure}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00155}00155 \textcolor{comment}{ * @param offset Offset from the beginning of the structure to the member being}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00156}00156 \textcolor{comment}{ *               accessed.}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00157}00157 \textcolor{comment}{ * @param size   Size of the structure member.}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00158}00158 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00159}00159 \textcolor{comment}{ * @return Value of the structure member promoted into a uint64\_t.}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00160}00160 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00161}00161 \textcolor{keyword}{static} \textcolor{keyword}{inline} uint64\_t}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00162}\mbox{\hyperlink{lio__console_8c_a9c5d689ac5ba1c8bed6072c432e2b327}{00162}} \mbox{\hyperlink{lio__console_8c_a9c5d689ac5ba1c8bed6072c432e2b327}{\_\_cvmx\_bootmem\_desc\_get}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structocteon__device}{octeon\_device}} *oct, uint64\_t base,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00163}00163                         uint32\_t offset, uint32\_t size)}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00164}00164 \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00165}00165 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00166}00166         base = (1ull << 63) | (base + offset);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00167}00167         \textcolor{keywordflow}{switch} (size) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00168}00168         \textcolor{keywordflow}{case} 4:}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00169}00169                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{lio__mem__ops_8c_a93793dfe1384b5c18ff5b96b51d55a61}{lio\_read\_device\_mem32}}(oct, base));}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00170}00170         \textcolor{keywordflow}{case} 8:}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00171}00171                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{lio__mem__ops_8c_aa1bf6312e87aa3edf0277d170a3500b5}{lio\_read\_device\_mem64}}(oct, base));}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00172}00172         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00173}00173                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00174}00174         \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00175}00175 \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00176}00176 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00177}00177 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00178}00178 \textcolor{comment}{ * This function retrieves the string name of a named block. It is}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00179}00179 \textcolor{comment}{ * more complicated than a simple memcpy() since the named block}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00180}00180 \textcolor{comment}{ * descriptor may not be directly accessible.}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00181}00181 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00182}00182 \textcolor{comment}{ * @param oct    Pointer to current octeon device}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00183}00183 \textcolor{comment}{ * @param addr   Physical address of the named block descriptor}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00184}00184 \textcolor{comment}{ * @param str    String to receive the named block string name}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00185}00185 \textcolor{comment}{ * @param len    Length of the string buffer, which must match the length}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00186}00186 \textcolor{comment}{ *               stored in the bootmem descriptor.}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00187}00187 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00188}00188 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00189}\mbox{\hyperlink{lio__console_8c_acbafda39b5a3322d1878fd61a1337560}{00189}} \mbox{\hyperlink{lio__console_8c_acbafda39b5a3322d1878fd61a1337560}{lio\_bootmem\_named\_get\_name}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structocteon__device}{octeon\_device}} *oct, uint64\_t addr, \textcolor{keywordtype}{char} *str,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00190}00190                            uint32\_t len)}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00191}00191 \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00192}00192 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00193}00193         addr += offsetof(\textcolor{keyword}{struct} \mbox{\hyperlink{structcvmx__bootmem__named__block__desc}{cvmx\_bootmem\_named\_block\_desc}}, name);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00194}00194         \mbox{\hyperlink{lio__mem__ops_8c_a45994a9251fc63e2f51c86b503773cce}{lio\_pci\_read\_core\_mem}}(oct, addr, (uint8\_t *) str, len);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00195}00195         str[len] = 0;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00196}00196 \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00197}00197 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00198}00198 \textcolor{comment}{/* See header file for descriptions of functions */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00199}00199 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00200}00200 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00201}00201 \textcolor{comment}{ * Check the version information on the bootmem descriptor}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00202}00202 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00203}00203 \textcolor{comment}{ * @param oct    Pointer to current octeon device}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00204}00204 \textcolor{comment}{ * @param exact\_match}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00205}00205 \textcolor{comment}{ *              Exact major version to check against. A zero means}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00206}00206 \textcolor{comment}{ *              check that the version supports named blocks.}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00207}00207 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00208}00208 \textcolor{comment}{ * @return Zero if the version is correct. Negative if the version is}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00209}00209 \textcolor{comment}{ *         incorrect. Failures also cause a message to be displayed.}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00210}00210 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00211}00211 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00212}\mbox{\hyperlink{lio__console_8c_a82a88e55e94eea7b00bf6eff92e2cb61}{00212}} \mbox{\hyperlink{lio__console_8c_a82a88e55e94eea7b00bf6eff92e2cb61}{\_\_cvmx\_bootmem\_check\_version}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structocteon__device}{octeon\_device}} *oct, uint32\_t exact\_match)}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00213}00213 \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00214}00214         uint32\_t        major\_version;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00215}00215         uint32\_t        minor\_version;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00216}00216 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00217}00217         \textcolor{keywordflow}{if} (!oct-\/>\mbox{\hyperlink{structocteon__device_a5ddebffc6b47a55245f551990412b994}{bootmem\_desc\_addr}})}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00218}00218                 oct-\/>\mbox{\hyperlink{structocteon__device_a5ddebffc6b47a55245f551990412b994}{bootmem\_desc\_addr}} =}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00219}00219                         \mbox{\hyperlink{lio__mem__ops_8c_aa1bf6312e87aa3edf0277d170a3500b5}{lio\_read\_device\_mem64}}(oct,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00220}00220                                         \mbox{\hyperlink{lio__console_8c_a58dfca4fc61f3b9894f8d075cc291601}{LIO\_BOOTLOADER\_PCI\_READ\_DESC\_ADDR}});}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00221}00221 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00222}00222         major\_version = (uint32\_t) \mbox{\hyperlink{lio__console_8c_a9c5d689ac5ba1c8bed6072c432e2b327}{\_\_cvmx\_bootmem\_desc\_get}}(oct,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00223}00223                         oct-\/>\mbox{\hyperlink{structocteon__device_a5ddebffc6b47a55245f551990412b994}{bootmem\_desc\_addr}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00224}00224                         offsetof(\textcolor{keyword}{struct} \mbox{\hyperlink{structcvmx__bootmem__desc}{cvmx\_bootmem\_desc}}, major\_version),}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00225}00225                         \mbox{\hyperlink{lio__console_8c_a702b0dd1ac75146dd5ef8d96a5150588}{SIZEOF\_FIELD}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcvmx__bootmem__desc}{cvmx\_bootmem\_desc}}, major\_version));}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00226}00226         minor\_version = (uint32\_t) \mbox{\hyperlink{lio__console_8c_a9c5d689ac5ba1c8bed6072c432e2b327}{\_\_cvmx\_bootmem\_desc\_get}}(oct,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00227}00227                         oct-\/>\mbox{\hyperlink{structocteon__device_a5ddebffc6b47a55245f551990412b994}{bootmem\_desc\_addr}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00228}00228                         offsetof(\textcolor{keyword}{struct} \mbox{\hyperlink{structcvmx__bootmem__desc}{cvmx\_bootmem\_desc}}, minor\_version),}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00229}00229                         \mbox{\hyperlink{lio__console_8c_a702b0dd1ac75146dd5ef8d96a5150588}{SIZEOF\_FIELD}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcvmx__bootmem__desc}{cvmx\_bootmem\_desc}}, minor\_version));}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00230}00230 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00231}00231         \mbox{\hyperlink{lio__bsd_8h_a1e6b64f2d951d285e7d956ce8cd5dd04}{lio\_dev\_dbg}}(oct, \textcolor{stringliteral}{"{}\%s: major\_version=\%d\(\backslash\)n"{}}, \_\_func\_\_, major\_version);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00232}00232         \textcolor{keywordflow}{if} ((major\_version > 3) ||}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00233}00233             (exact\_match \&\& major\_version != exact\_match)) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00234}00234                 \mbox{\hyperlink{lio__bsd_8h_abe414f7d7854f53de3fe9db975df03db}{lio\_dev\_err}}(oct, \textcolor{stringliteral}{"{}bootmem ver mismatch \%d.\%d addr:0x\%llx\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00235}00235                             major\_version, minor\_version,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00236}00236                             \mbox{\hyperlink{lio__console_8c_a7ad1a62c1c012e0acd975d8f22c372fe}{CAST\_ULL}}(oct-\/>\mbox{\hyperlink{structocteon__device_a5ddebffc6b47a55245f551990412b994}{bootmem\_desc\_addr}}));}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00237}00237                 \textcolor{keywordflow}{return} (-\/1);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00238}00238         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00239}00239                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00240}00240         \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00241}00241 \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00242}00242 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00243}00243 \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structcvmx__bootmem__named__block__desc}{cvmx\_bootmem\_named\_block\_desc}} *}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00244}\mbox{\hyperlink{lio__console_8c_acd48e30afe46f58bb7962ff98db99b8c}{00244}} \mbox{\hyperlink{lio__console_8c_acd48e30afe46f58bb7962ff98db99b8c}{\_\_cvmx\_bootmem\_find\_named\_block\_flags}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structocteon__device}{octeon\_device}} *oct,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00245}00245                                       \textcolor{keyword}{const} \textcolor{keywordtype}{char} *\mbox{\hyperlink{structcvmx__bootmem__named__block__desc_a853ce1d152770732dbf998a91acba356}{name}}, uint32\_t flags)}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00246}00246 \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00247}00247         \textcolor{keyword}{struct }\mbox{\hyperlink{structcvmx__bootmem__named__block__desc}{cvmx\_bootmem\_named\_block\_desc}}       *desc =}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00248}00248                 \&oct-\/>\mbox{\hyperlink{structocteon__device_a37a06a1982d77c47ee5144080b41f574}{bootmem\_named\_block\_desc}};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00249}00249         uint64\_t        named\_addr;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00250}00250 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00251}00251         named\_addr = \mbox{\hyperlink{lio__console_8c_a82da54f95d48fc497439779e0211409f}{cvmx\_bootmem\_phy\_named\_block\_find}}(oct, \mbox{\hyperlink{structcvmx__bootmem__named__block__desc_a853ce1d152770732dbf998a91acba356}{name}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00252}00252                                                        flags);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00253}00253         \textcolor{keywordflow}{if} (named\_addr) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00254}00254                 desc-\/>\mbox{\hyperlink{structcvmx__bootmem__named__block__desc_a1151a1cfbd1d6ff305f49652ab7f81a2}{base\_addr}} = \mbox{\hyperlink{lio__console_8c_a9c5d689ac5ba1c8bed6072c432e2b327}{\_\_cvmx\_bootmem\_desc\_get}}(oct, named\_addr,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00255}00255                         offsetof(\textcolor{keyword}{struct} \mbox{\hyperlink{structcvmx__bootmem__named__block__desc}{cvmx\_bootmem\_named\_block\_desc}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00256}00256                                  \mbox{\hyperlink{structcvmx__bootmem__named__block__desc_a1151a1cfbd1d6ff305f49652ab7f81a2}{base\_addr}}),}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00257}00257                         \mbox{\hyperlink{lio__console_8c_a702b0dd1ac75146dd5ef8d96a5150588}{SIZEOF\_FIELD}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcvmx__bootmem__named__block__desc}{cvmx\_bootmem\_named\_block\_desc}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00258}00258                                      \mbox{\hyperlink{structcvmx__bootmem__named__block__desc_a1151a1cfbd1d6ff305f49652ab7f81a2}{base\_addr}}));}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00259}00259 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00260}00260                 desc-\/>\mbox{\hyperlink{structcvmx__bootmem__named__block__desc_aa60f8cb47bec813f6c95456016997616}{size}} = \mbox{\hyperlink{lio__console_8c_a9c5d689ac5ba1c8bed6072c432e2b327}{\_\_cvmx\_bootmem\_desc\_get}}(oct, named\_addr,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00261}00261                          offsetof(\textcolor{keyword}{struct} \mbox{\hyperlink{structcvmx__bootmem__named__block__desc}{cvmx\_bootmem\_named\_block\_desc}}, \mbox{\hyperlink{structcvmx__bootmem__named__block__desc_aa60f8cb47bec813f6c95456016997616}{size}}),}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00262}00262                          \mbox{\hyperlink{lio__console_8c_a702b0dd1ac75146dd5ef8d96a5150588}{SIZEOF\_FIELD}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcvmx__bootmem__named__block__desc}{cvmx\_bootmem\_named\_block\_desc}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00263}00263                                       \mbox{\hyperlink{structcvmx__bootmem__named__block__desc_aa60f8cb47bec813f6c95456016997616}{size}}));}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00264}00264 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00265}00265                 strncpy(desc-\/>\mbox{\hyperlink{structcvmx__bootmem__named__block__desc_a853ce1d152770732dbf998a91acba356}{name}}, \mbox{\hyperlink{structcvmx__bootmem__named__block__desc_a853ce1d152770732dbf998a91acba356}{name}}, \textcolor{keyword}{sizeof}(desc-\/>\mbox{\hyperlink{structcvmx__bootmem__named__block__desc_a853ce1d152770732dbf998a91acba356}{name}}));}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00266}00266                 desc-\/>\mbox{\hyperlink{structcvmx__bootmem__named__block__desc_a853ce1d152770732dbf998a91acba356}{name}}[\textcolor{keyword}{sizeof}(desc-\/>\mbox{\hyperlink{structcvmx__bootmem__named__block__desc_a853ce1d152770732dbf998a91acba356}{name}}) -\/ 1] = 0;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00267}00267 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00268}00268                 \textcolor{keywordflow}{return} (\&oct-\/>\mbox{\hyperlink{structocteon__device_a37a06a1982d77c47ee5144080b41f574}{bootmem\_named\_block\_desc}});}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00269}00269         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00270}00270                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00271}00271         \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00272}00272 \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00273}00273 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00274}00274 \textcolor{keyword}{static} uint64\_t}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00275}\mbox{\hyperlink{lio__console_8c_a82da54f95d48fc497439779e0211409f}{00275}} \mbox{\hyperlink{lio__console_8c_a82da54f95d48fc497439779e0211409f}{cvmx\_bootmem\_phy\_named\_block\_find}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structocteon__device}{octeon\_device}} *oct, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *\mbox{\hyperlink{structcvmx__bootmem__named__block__desc_a853ce1d152770732dbf998a91acba356}{name}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00276}00276                                   uint32\_t flags)}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00277}00277 \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00278}00278         uint64\_t        result = 0;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00279}00279 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00280}00280         \textcolor{keywordflow}{if} (!\mbox{\hyperlink{lio__console_8c_a82a88e55e94eea7b00bf6eff92e2cb61}{\_\_cvmx\_bootmem\_check\_version}}(oct, 3)) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00281}00281                 uint32\_t i;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00282}00282 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00283}00283                 uint64\_t named\_block\_array\_addr =}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00284}00284                         \mbox{\hyperlink{lio__console_8c_a9c5d689ac5ba1c8bed6072c432e2b327}{\_\_cvmx\_bootmem\_desc\_get}}(oct, oct-\/>\mbox{\hyperlink{structocteon__device_a5ddebffc6b47a55245f551990412b994}{bootmem\_desc\_addr}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00285}00285                                         offsetof(\textcolor{keyword}{struct} \mbox{\hyperlink{structcvmx__bootmem__desc}{cvmx\_bootmem\_desc}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00286}00286                                                  named\_block\_array\_addr),}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00287}00287                                         \mbox{\hyperlink{lio__console_8c_a702b0dd1ac75146dd5ef8d96a5150588}{SIZEOF\_FIELD}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcvmx__bootmem__desc}{cvmx\_bootmem\_desc}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00288}00288                                                      named\_block\_array\_addr));}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00289}00289                 uint32\_t num\_blocks =}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00290}00290                         (uint32\_t) \mbox{\hyperlink{lio__console_8c_a9c5d689ac5ba1c8bed6072c432e2b327}{\_\_cvmx\_bootmem\_desc\_get}}(oct,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00291}00291                                         oct-\/>\mbox{\hyperlink{structocteon__device_a5ddebffc6b47a55245f551990412b994}{bootmem\_desc\_addr}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00292}00292                                         offsetof(\textcolor{keyword}{struct} \mbox{\hyperlink{structcvmx__bootmem__desc}{cvmx\_bootmem\_desc}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00293}00293                                                  nb\_num\_blocks),}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00294}00294                                         \mbox{\hyperlink{lio__console_8c_a702b0dd1ac75146dd5ef8d96a5150588}{SIZEOF\_FIELD}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcvmx__bootmem__desc}{cvmx\_bootmem\_desc}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00295}00295                                                      nb\_num\_blocks));}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00296}00296 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00297}00297                 uint32\_t name\_length =}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00298}00298                         (uint32\_t) \mbox{\hyperlink{lio__console_8c_a9c5d689ac5ba1c8bed6072c432e2b327}{\_\_cvmx\_bootmem\_desc\_get}}(oct,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00299}00299                                         oct-\/>\mbox{\hyperlink{structocteon__device_a5ddebffc6b47a55245f551990412b994}{bootmem\_desc\_addr}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00300}00300                                         offsetof(\textcolor{keyword}{struct} \mbox{\hyperlink{structcvmx__bootmem__desc}{cvmx\_bootmem\_desc}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00301}00301                                                  named\_block\_name\_len),}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00302}00302                                         \mbox{\hyperlink{lio__console_8c_a702b0dd1ac75146dd5ef8d96a5150588}{SIZEOF\_FIELD}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcvmx__bootmem__desc}{cvmx\_bootmem\_desc}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00303}00303                                                      named\_block\_name\_len));}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00304}00304 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00305}00305                 uint64\_t named\_addr = named\_block\_array\_addr;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00306}00306 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00307}00307                 \textcolor{keywordflow}{for} (i = 0; i < num\_blocks; i++) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00308}00308                         uint64\_t named\_size =}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00309}00309                           \mbox{\hyperlink{lio__console_8c_a9c5d689ac5ba1c8bed6072c432e2b327}{\_\_cvmx\_bootmem\_desc\_get}}(oct, named\_addr,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00310}00310                             offsetof(\textcolor{keyword}{struct} \mbox{\hyperlink{structcvmx__bootmem__named__block__desc}{cvmx\_bootmem\_named\_block\_desc}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00311}00311                                      \mbox{\hyperlink{structcvmx__bootmem__named__block__desc_aa60f8cb47bec813f6c95456016997616}{size}}),}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00312}00312                             \mbox{\hyperlink{lio__console_8c_a702b0dd1ac75146dd5ef8d96a5150588}{SIZEOF\_FIELD}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcvmx__bootmem__named__block__desc}{cvmx\_bootmem\_named\_block\_desc}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00313}00313                                          \mbox{\hyperlink{structcvmx__bootmem__named__block__desc_aa60f8cb47bec813f6c95456016997616}{size}}));}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00314}00314 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00315}00315                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structcvmx__bootmem__named__block__desc_a853ce1d152770732dbf998a91acba356}{name}} \&\& named\_size) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00316}00316                                 \textcolor{keywordtype}{char}    *name\_tmp = malloc(name\_length + 1,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00317}00317                                                            M\_DEVBUF, M\_NOWAIT |}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00318}00318                                                            M\_ZERO);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00319}00319                                 \textcolor{keywordflow}{if} (!name\_tmp)}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00320}00320                                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00321}00321 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00322}00322                                 \mbox{\hyperlink{lio__console_8c_acbafda39b5a3322d1878fd61a1337560}{lio\_bootmem\_named\_get\_name}}(oct, named\_addr,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00323}00323                                                            name\_tmp,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00324}00324                                                            name\_length);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00325}00325 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00326}00326                                 \textcolor{keywordflow}{if} (!strncmp(\mbox{\hyperlink{structcvmx__bootmem__named__block__desc_a853ce1d152770732dbf998a91acba356}{name}}, name\_tmp, name\_length)) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00327}00327                                         result = named\_addr;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00328}00328                                         free(name\_tmp, M\_DEVBUF);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00329}00329                                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00330}00330                                 \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00331}00331 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00332}00332                                 free(name\_tmp, M\_DEVBUF);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00333}00333 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00334}00334                         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!\mbox{\hyperlink{structcvmx__bootmem__named__block__desc_a853ce1d152770732dbf998a91acba356}{name}} \&\& !named\_size) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00335}00335                                 result = named\_addr;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00336}00336                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00337}00337                         \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00338}00338 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00339}00339                         named\_addr +=}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00340}00340                                 \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct }\mbox{\hyperlink{structcvmx__bootmem__named__block__desc}{cvmx\_bootmem\_named\_block\_desc}});}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00341}00341                 \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00342}00342         \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00343}00343         \textcolor{keywordflow}{return} (result);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00344}00344 \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00345}00345 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00346}00346 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00347}00347 \textcolor{comment}{ * Find a named block on the remote Octeon}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00348}00348 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00349}00349 \textcolor{comment}{ * @param oct       Pointer to current octeon device}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00350}00350 \textcolor{comment}{ * @param name      Name of block to find}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00351}00351 \textcolor{comment}{ * @param base\_addr Address the block is at (OUTPUT)}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00352}00352 \textcolor{comment}{ * @param size      The size of the block (OUTPUT)}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00353}00353 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00354}00354 \textcolor{comment}{ * @return Zero on success, One on failure.}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00355}00355 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00356}00356 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00357}\mbox{\hyperlink{lio__console_8c_a72055dc240dead97ba42ff0dde329a32}{00357}} \mbox{\hyperlink{lio__console_8c_a72055dc240dead97ba42ff0dde329a32}{lio\_named\_block\_find}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structocteon__device}{octeon\_device}} *oct, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *\mbox{\hyperlink{structcvmx__bootmem__named__block__desc_a853ce1d152770732dbf998a91acba356}{name}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00358}00358                      uint64\_t * \mbox{\hyperlink{structcvmx__bootmem__named__block__desc_a1151a1cfbd1d6ff305f49652ab7f81a2}{base\_addr}}, uint64\_t * \mbox{\hyperlink{structcvmx__bootmem__named__block__desc_aa60f8cb47bec813f6c95456016997616}{size}})}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00359}00359 \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00360}00360         \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structcvmx__bootmem__named__block__desc}{cvmx\_bootmem\_named\_block\_desc}} *named\_block;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00361}00361 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00362}00362         \mbox{\hyperlink{lio__console_8c_a954d8088823e16bbc291c4855a1b7310}{lio\_remote\_lock}}();}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00363}00363         named\_block = \mbox{\hyperlink{lio__console_8c_acd48e30afe46f58bb7962ff98db99b8c}{\_\_cvmx\_bootmem\_find\_named\_block\_flags}}(oct, \mbox{\hyperlink{structcvmx__bootmem__named__block__desc_a853ce1d152770732dbf998a91acba356}{name}}, 0);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00364}00364         \mbox{\hyperlink{lio__console_8c_a10aa47e840712fb04f96a2663b53b727}{lio\_remote\_unlock}}();}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00365}00365         \textcolor{keywordflow}{if} (named\_block != NULL) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00366}00366                 *\mbox{\hyperlink{structcvmx__bootmem__named__block__desc_a1151a1cfbd1d6ff305f49652ab7f81a2}{base\_addr}} = named\_block-\/>\mbox{\hyperlink{structcvmx__bootmem__named__block__desc_a1151a1cfbd1d6ff305f49652ab7f81a2}{base\_addr}};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00367}00367                 *\mbox{\hyperlink{structcvmx__bootmem__named__block__desc_aa60f8cb47bec813f6c95456016997616}{size}} = named\_block-\/>\mbox{\hyperlink{structcvmx__bootmem__named__block__desc_aa60f8cb47bec813f6c95456016997616}{size}};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00368}00368                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00369}00369         \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00370}00370 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00371}00371         \textcolor{keywordflow}{return} (1);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00372}00372 \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00373}00373 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00374}00374 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00375}00375 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00376}\mbox{\hyperlink{lio__console_8c_a954d8088823e16bbc291c4855a1b7310}{00376}} \mbox{\hyperlink{lio__console_8c_a954d8088823e16bbc291c4855a1b7310}{lio\_remote\_lock}}(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00377}00377 \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00378}00378 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00379}00379         \textcolor{comment}{/* fill this in if any sharing is needed */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00380}00380 \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00381}00381 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00382}00382 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00383}\mbox{\hyperlink{lio__console_8c_a10aa47e840712fb04f96a2663b53b727}{00383}} \mbox{\hyperlink{lio__console_8c_a10aa47e840712fb04f96a2663b53b727}{lio\_remote\_unlock}}(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00384}00384 \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00385}00385 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00386}00386         \textcolor{comment}{/* fill this in if any sharing is needed */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00387}00387 \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00388}00388 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00389}00389 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00390}\mbox{\hyperlink{lio__console_8c_ab5366969909f9cce5bd208c1271c4b19}{00390}} \mbox{\hyperlink{lio__console_8c_ab5366969909f9cce5bd208c1271c4b19}{lio\_console\_send\_cmd}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structocteon__device}{octeon\_device}} *oct, \textcolor{keywordtype}{char} *cmd\_str,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00391}00391                      uint32\_t wait\_hundredths)}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00392}00392 \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00393}00393         uint32\_t        len = (uint32\_t) strlen(cmd\_str);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00394}00394 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00395}00395         \mbox{\hyperlink{lio__bsd_8h_a1e6b64f2d951d285e7d956ce8cd5dd04}{lio\_dev\_dbg}}(oct, \textcolor{stringliteral}{"{}sending \(\backslash\)"{}\%s\(\backslash\)"{} to bootloader\(\backslash\)n"{}}, cmd\_str);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00396}00396 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00397}00397         \textcolor{keywordflow}{if} (len > \mbox{\hyperlink{lio__console_8c_a175b9bdf90adddf16370a8b3961a4fb1}{LIO\_BOOTLOADER\_PCI\_WRITE\_BUFFER\_STR\_LEN}} -\/ 1) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00398}00398                 \mbox{\hyperlink{lio__bsd_8h_abe414f7d7854f53de3fe9db975df03db}{lio\_dev\_err}}(oct, \textcolor{stringliteral}{"{}Command string too long, max length is: \%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00399}00399                             \mbox{\hyperlink{lio__console_8c_a175b9bdf90adddf16370a8b3961a4fb1}{LIO\_BOOTLOADER\_PCI\_WRITE\_BUFFER\_STR\_LEN}} -\/ 1);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00400}00400                 \textcolor{keywordflow}{return} (-\/1);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00401}00401         \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00402}00402 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00403}00403         \textcolor{keywordflow}{if} (\mbox{\hyperlink{lio__console_8c_af4510ca9c7c7627e57ba92f182267c51}{lio\_wait\_for\_bootloader}}(oct, wait\_hundredths)) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00404}00404                 \mbox{\hyperlink{lio__bsd_8h_abe414f7d7854f53de3fe9db975df03db}{lio\_dev\_err}}(oct, \textcolor{stringliteral}{"{}Bootloader not ready for command.\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00405}00405                 \textcolor{keywordflow}{return} (-\/1);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00406}00406         \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00407}00407 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00408}00408         \textcolor{comment}{/* Write command to bootloader */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00409}00409         \mbox{\hyperlink{lio__console_8c_a954d8088823e16bbc291c4855a1b7310}{lio\_remote\_lock}}();}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00410}00410         \mbox{\hyperlink{lio__mem__ops_8c_a1369fd16acd4008689763e9a39154db3}{lio\_pci\_write\_core\_mem}}(oct, \mbox{\hyperlink{lio__console_8c_aac0f29a3c0441968f2813a23d11b12a3}{LIO\_BOOTLOADER\_PCI\_READ\_BUFFER\_DATA\_ADDR}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00411}00411                                (uint8\_t *) cmd\_str, len);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00412}00412         \mbox{\hyperlink{lio__mem__ops_8c_ac4351e9029c6e41f375ce98a39ff83d4}{lio\_write\_device\_mem32}}(oct, \mbox{\hyperlink{lio__console_8c_a51cc6ba972085cad8b826e913284d7c1}{LIO\_BOOTLOADER\_PCI\_READ\_BUFFER\_LEN\_ADDR}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00413}00413                                len);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00414}00414         \mbox{\hyperlink{lio__mem__ops_8c_ac4351e9029c6e41f375ce98a39ff83d4}{lio\_write\_device\_mem32}}(oct, \mbox{\hyperlink{lio__console_8c_a0b4ca8b680b72ad593f839619b96aa92}{LIO\_BOOTLOADER\_PCI\_READ\_BUFFER\_OWNER\_ADDR}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00415}00415                                \mbox{\hyperlink{lio__console_8c_a11c5360803c1ce87c2a999cd811f1f07}{LIO\_PCI\_IO\_BUF\_OWNER\_OCTEON}});}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00416}00416 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00417}00417         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00418}00418 \textcolor{comment}{         * Bootloader should accept command very quickly if it really was}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00419}00419 \textcolor{comment}{         * ready}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00420}00420 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00421}00421         \textcolor{keywordflow}{if} (\mbox{\hyperlink{lio__console_8c_af4510ca9c7c7627e57ba92f182267c51}{lio\_wait\_for\_bootloader}}(oct, 200)) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00422}00422                 \mbox{\hyperlink{lio__console_8c_a10aa47e840712fb04f96a2663b53b727}{lio\_remote\_unlock}}();}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00423}00423                 \mbox{\hyperlink{lio__bsd_8h_abe414f7d7854f53de3fe9db975df03db}{lio\_dev\_err}}(oct, \textcolor{stringliteral}{"{}Bootloader did not accept command.\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00424}00424                 \textcolor{keywordflow}{return} (-\/1);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00425}00425         \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00426}00426 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00427}00427         \mbox{\hyperlink{lio__console_8c_a10aa47e840712fb04f96a2663b53b727}{lio\_remote\_unlock}}();}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00428}00428         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00429}00429 \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00430}00430 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00431}00431 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00432}\mbox{\hyperlink{lio__console_8c_af4510ca9c7c7627e57ba92f182267c51}{00432}} \mbox{\hyperlink{lio__console_8c_af4510ca9c7c7627e57ba92f182267c51}{lio\_wait\_for\_bootloader}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structocteon__device}{octeon\_device}} *oct,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00433}00433                         uint32\_t wait\_time\_hundredths)}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00434}00434 \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00435}00435         \mbox{\hyperlink{lio__bsd_8h_a1e6b64f2d951d285e7d956ce8cd5dd04}{lio\_dev\_dbg}}(oct, \textcolor{stringliteral}{"{}waiting \%d0 ms for bootloader\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00436}00436                     wait\_time\_hundredths);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00437}00437 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00438}00438         \textcolor{keywordflow}{if} (\mbox{\hyperlink{lio__device_8c_a3afe7f956dd8bf370041885e845fa0b3}{lio\_mem\_access\_ok}}(oct))}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00439}00439                 \textcolor{keywordflow}{return} (-\/1);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00440}00440 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00441}00441         \textcolor{keywordflow}{while} (wait\_time\_hundredths > 0 \&\&}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00442}00442                \mbox{\hyperlink{lio__mem__ops_8c_a93793dfe1384b5c18ff5b96b51d55a61}{lio\_read\_device\_mem32}}(oct,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00443}00443                                 \mbox{\hyperlink{lio__console_8c_a0b4ca8b680b72ad593f839619b96aa92}{LIO\_BOOTLOADER\_PCI\_READ\_BUFFER\_OWNER\_ADDR}}) !=}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00444}00444                \mbox{\hyperlink{lio__console_8c_a1c4abb9ed40bfc0410a5efc2dec4e428}{LIO\_PCI\_IO\_BUF\_OWNER\_HOST}}) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00445}00445                 \textcolor{keywordflow}{if} (-\/-\/wait\_time\_hundredths <= 0)}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00446}00446                         \textcolor{keywordflow}{return} (-\/1);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00447}00447 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00448}00448                 \mbox{\hyperlink{lio__bsd_8h_a7127c19922ac115d8494a76ae19d0480}{lio\_sleep\_timeout}}(10);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00449}00449         \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00450}00450 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00451}00451         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00452}00452 \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00453}00453 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00454}00454 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00455}\mbox{\hyperlink{lio__console_8c_a1b07b5c98da17405593e2bd965a9b963}{00455}} \mbox{\hyperlink{lio__console_8c_a1b07b5c98da17405593e2bd965a9b963}{lio\_console\_handle\_result}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structocteon__device}{octeon\_device}} *oct, \textcolor{keywordtype}{size\_t} console\_num)}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00456}00456 \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00457}00457         \textcolor{keyword}{struct }\mbox{\hyperlink{structlio__console}{lio\_console}}   *console;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00458}00458 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00459}00459         console = \&oct-\/>\mbox{\hyperlink{structocteon__device_af9094f8dfbf00973939ae87001b9c0db}{console}}[console\_num];}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00460}00460 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00461}00461         console-\/>\mbox{\hyperlink{structlio__console_a8e6deee56edcd814c39c1caa5c7c7801}{waiting}} = 0;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00462}00462 \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00463}00463 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00464}\mbox{\hyperlink{lio__console_8c_abec4a6f99fa0b30d6ea34db20777760b}{00464}} \textcolor{keyword}{static} \textcolor{keywordtype}{char}     \mbox{\hyperlink{lio__console_8c_abec4a6f99fa0b30d6ea34db20777760b}{console\_buffer}}[\mbox{\hyperlink{lio__device_8h_a2a89cbef1320d53c51aff3b69bbc1e63}{LIO\_MAX\_CONSOLE\_READ\_BYTES}}];}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00465}00465 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00466}00466 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00467}\mbox{\hyperlink{lio__console_8c_a71163063d7df291e51c77ccf9118b154}{00467}} \mbox{\hyperlink{lio__console_8c_a71163063d7df291e51c77ccf9118b154}{lio\_output\_console\_line}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structocteon__device}{octeon\_device}} *oct, \textcolor{keyword}{struct} \mbox{\hyperlink{structlio__console}{lio\_console}} *console,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00468}00468                         \textcolor{keywordtype}{size\_t} console\_num, \textcolor{keywordtype}{char} *\mbox{\hyperlink{lio__console_8c_abec4a6f99fa0b30d6ea34db20777760b}{console\_buffer}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00469}00469                         int32\_t bytes\_read)}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00470}00470 \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00471}00471         \textcolor{keywordtype}{size\_t}          len;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00472}00472         int32\_t         i;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00473}00473         \textcolor{keywordtype}{char}           *line;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00474}00474 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00475}00475         line = \mbox{\hyperlink{lio__console_8c_abec4a6f99fa0b30d6ea34db20777760b}{console\_buffer}};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00476}00476         \textcolor{keywordflow}{for} (i = 0; i < bytes\_read; i++) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00477}00477                 \textcolor{comment}{/* Output a line at a time, prefixed */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00478}00478                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{lio__console_8c_abec4a6f99fa0b30d6ea34db20777760b}{console\_buffer}}[i] == \textcolor{charliteral}{'\(\backslash\)n'}) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00479}00479                         \mbox{\hyperlink{lio__console_8c_abec4a6f99fa0b30d6ea34db20777760b}{console\_buffer}}[i] = \textcolor{charliteral}{'\(\backslash\)0'};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00480}00480                         \textcolor{comment}{/* We need to output 'line', prefaced by 'leftover'.}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00481}00481 \textcolor{comment}{                         * However, it is possible we're being called to}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00482}00482 \textcolor{comment}{                         * output 'leftover' by itself (in the case of nothing}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00483}00483 \textcolor{comment}{                         * having been read from the console).}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00484}00484 \textcolor{comment}{                         *}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00485}00485 \textcolor{comment}{                         * To avoid duplication, check for this condition.}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00486}00486 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00487}00487                         \textcolor{keywordflow}{if} (console-\/>\mbox{\hyperlink{structlio__console_a32b70267d933965a6eed0cd53b3580c2}{leftover}}[0] \&\&}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00488}00488                             (line != console-\/>\mbox{\hyperlink{structlio__console_a32b70267d933965a6eed0cd53b3580c2}{leftover}})) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00489}00489                                 \textcolor{keywordflow}{if} (console-\/>\mbox{\hyperlink{structlio__console_a8cc46ef8a99915c4bc9072ce8aeff55b}{print}})}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00490}00490                                         (*console-\/>\mbox{\hyperlink{structlio__console_a8cc46ef8a99915c4bc9072ce8aeff55b}{print}})(oct,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00491}00491                                                           (uint32\_t)console\_num,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00492}00492                                                         console-\/>\mbox{\hyperlink{structlio__console_a32b70267d933965a6eed0cd53b3580c2}{leftover}},line);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00493}00493                                 console-\/>\mbox{\hyperlink{structlio__console_a32b70267d933965a6eed0cd53b3580c2}{leftover}}[0] = \textcolor{charliteral}{'\(\backslash\)0'};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00494}00494                         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00495}00495                                 \textcolor{keywordflow}{if} (console-\/>\mbox{\hyperlink{structlio__console_a8cc46ef8a99915c4bc9072ce8aeff55b}{print}})}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00496}00496                                         (*console-\/>\mbox{\hyperlink{structlio__console_a8cc46ef8a99915c4bc9072ce8aeff55b}{print}})(oct,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00497}00497                                                           (uint32\_t)console\_num,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00498}00498                                                           line, NULL);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00499}00499                         \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00500}00500 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00501}00501                         line = \&\mbox{\hyperlink{lio__console_8c_abec4a6f99fa0b30d6ea34db20777760b}{console\_buffer}}[i + 1];}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00502}00502                 \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00503}00503         \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00504}00504 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00505}00505         \textcolor{comment}{/* Save off any leftovers */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00506}00506         \textcolor{keywordflow}{if} (line != \&\mbox{\hyperlink{lio__console_8c_abec4a6f99fa0b30d6ea34db20777760b}{console\_buffer}}[bytes\_read]) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00507}00507                 \mbox{\hyperlink{lio__console_8c_abec4a6f99fa0b30d6ea34db20777760b}{console\_buffer}}[bytes\_read] = \textcolor{charliteral}{'\(\backslash\)0'};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00508}00508                 len = strlen(console-\/>\mbox{\hyperlink{structlio__console_a32b70267d933965a6eed0cd53b3580c2}{leftover}});}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00509}00509                 strncpy(\&console-\/>\mbox{\hyperlink{structlio__console_a32b70267d933965a6eed0cd53b3580c2}{leftover}}[len], line,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00510}00510                         \textcolor{keyword}{sizeof}(console-\/>\mbox{\hyperlink{structlio__console_a32b70267d933965a6eed0cd53b3580c2}{leftover}}) -\/ len);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00511}00511         \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00512}00512 \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00513}00513 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00514}00514 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00515}\mbox{\hyperlink{lio__console_8c_ab1a6def6e82cf9c8b4df5b5226e1b142}{00515}} \mbox{\hyperlink{lio__console_8c_ab1a6def6e82cf9c8b4df5b5226e1b142}{lio\_check\_console}}(\textcolor{keywordtype}{void} *arg)}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00516}00516 \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00517}00517         \textcolor{keyword}{struct }\mbox{\hyperlink{structlio__console}{lio\_console}} *console;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00518}00518         \textcolor{keyword}{struct }\mbox{\hyperlink{structlio__callout}{lio\_callout}} *console\_callout = arg;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00519}00519         \textcolor{keyword}{struct }\mbox{\hyperlink{structocteon__device}{octeon\_device}} *oct =}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00520}00520                 (\textcolor{keyword}{struct }\mbox{\hyperlink{structocteon__device}{octeon\_device}} *)console\_callout-\/>\mbox{\hyperlink{structlio__callout_a676a86b6589efe52e8c829d625a9bb94}{ctxptr}};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00521}00521         \textcolor{keywordtype}{size\_t}          len;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00522}00522         uint32\_t        console\_num = (uint32\_t) console\_callout-\/>\mbox{\hyperlink{structlio__callout_a448d5b78fdfaed4d87ac51ef90c34e0d}{ctxul}};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00523}00523         int32\_t         bytes\_read, total\_read, tries;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00524}00524 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00525}00525         \mbox{\hyperlink{structocteon__device_af9094f8dfbf00973939ae87001b9c0db}{console}} = \&oct-\/>\mbox{\hyperlink{structocteon__device_af9094f8dfbf00973939ae87001b9c0db}{console}}[console\_num];}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00526}00526         tries = 0;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00527}00527         total\_read = 0;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00528}00528 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00529}00529         \textcolor{keywordflow}{if} (callout\_pending(\&console\_callout-\/>\mbox{\hyperlink{structlio__callout_af644c35302e054c86914dc14b0944e37}{timer}}) ||}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00530}00530             (callout\_active(\&console\_callout-\/>\mbox{\hyperlink{structlio__callout_af644c35302e054c86914dc14b0944e37}{timer}}) == 0))}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00531}00531                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00532}00532 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00533}00533         \textcolor{keywordflow}{do} \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00534}00534                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00535}00535 \textcolor{comment}{                 * Take console output regardless of whether it will be}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00536}00536 \textcolor{comment}{                 * logged}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00537}00537 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00538}00538                 bytes\_read = \mbox{\hyperlink{lio__console_8c_aaa6df0f3b5c13ba5909838a343de2a8b}{lio\_console\_read}}(oct, console\_num, \mbox{\hyperlink{lio__console_8c_abec4a6f99fa0b30d6ea34db20777760b}{console\_buffer}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00539}00539                                               \textcolor{keyword}{sizeof}(\mbox{\hyperlink{lio__console_8c_abec4a6f99fa0b30d6ea34db20777760b}{console\_buffer}}) -\/ 1);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00540}00540                 \textcolor{keywordflow}{if} (bytes\_read > 0) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00541}00541                         total\_read += bytes\_read;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00542}00542                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structocteon__device_af9094f8dfbf00973939ae87001b9c0db}{console}}-\/>\mbox{\hyperlink{structlio__console_a8e6deee56edcd814c39c1caa5c7c7801}{waiting}})}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00543}00543                                 \mbox{\hyperlink{lio__console_8c_a1b07b5c98da17405593e2bd965a9b963}{lio\_console\_handle\_result}}(oct, console\_num);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00544}00544 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00545}00545                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structocteon__device_af9094f8dfbf00973939ae87001b9c0db}{console}}-\/>\mbox{\hyperlink{structlio__console_a8cc46ef8a99915c4bc9072ce8aeff55b}{print}}) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00546}00546                                 \mbox{\hyperlink{lio__console_8c_a71163063d7df291e51c77ccf9118b154}{lio\_output\_console\_line}}(oct, \mbox{\hyperlink{structocteon__device_af9094f8dfbf00973939ae87001b9c0db}{console}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00547}00547                                                         console\_num,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00548}00548                                                         \mbox{\hyperlink{lio__console_8c_abec4a6f99fa0b30d6ea34db20777760b}{console\_buffer}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00549}00549                                                         bytes\_read);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00550}00550                         \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00551}00551 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00552}00552                 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (bytes\_read < 0) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00553}00553                         \mbox{\hyperlink{lio__bsd_8h_abe414f7d7854f53de3fe9db975df03db}{lio\_dev\_err}}(oct, \textcolor{stringliteral}{"{}Error reading console \%u, ret=\%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00554}00554                                     console\_num, bytes\_read);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00555}00555                 \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00556}00556 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00557}00557                 tries++;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00558}00558         \} \textcolor{keywordflow}{while} ((bytes\_read > 0) \&\& (tries < 16));}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00559}00559 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00560}00560         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00561}00561 \textcolor{comment}{         * If nothing is read after polling the console, output any leftovers}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00562}00562 \textcolor{comment}{         * if any}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00563}00563 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00564}00564         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structocteon__device_af9094f8dfbf00973939ae87001b9c0db}{console}}-\/>\mbox{\hyperlink{structlio__console_a8cc46ef8a99915c4bc9072ce8aeff55b}{print}} \&\& (total\_read == 0) \&\& (\mbox{\hyperlink{structocteon__device_af9094f8dfbf00973939ae87001b9c0db}{console}}-\/>\mbox{\hyperlink{structlio__console_a32b70267d933965a6eed0cd53b3580c2}{leftover}}[0])) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00565}00565                 \textcolor{comment}{/* append '\(\backslash\)n' as terminator for 'output\_console\_line' */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00566}00566                 len = strlen(\mbox{\hyperlink{structocteon__device_af9094f8dfbf00973939ae87001b9c0db}{console}}-\/>\mbox{\hyperlink{structlio__console_a32b70267d933965a6eed0cd53b3580c2}{leftover}});}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00567}00567                 \mbox{\hyperlink{structocteon__device_af9094f8dfbf00973939ae87001b9c0db}{console}}-\/>\mbox{\hyperlink{structlio__console_a32b70267d933965a6eed0cd53b3580c2}{leftover}}[len] = \textcolor{charliteral}{'\(\backslash\)n'};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00568}00568                 \mbox{\hyperlink{lio__console_8c_a71163063d7df291e51c77ccf9118b154}{lio\_output\_console\_line}}(oct, \mbox{\hyperlink{structocteon__device_af9094f8dfbf00973939ae87001b9c0db}{console}}, console\_num,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00569}00569                                         \mbox{\hyperlink{structocteon__device_af9094f8dfbf00973939ae87001b9c0db}{console}}-\/>\mbox{\hyperlink{structlio__console_a32b70267d933965a6eed0cd53b3580c2}{leftover}}, (int32\_t)(len + 1));}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00570}00570                 \mbox{\hyperlink{structocteon__device_af9094f8dfbf00973939ae87001b9c0db}{console}}-\/>\mbox{\hyperlink{structlio__console_a32b70267d933965a6eed0cd53b3580c2}{leftover}}[0] = \textcolor{charliteral}{'\(\backslash\)0'};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00571}00571         \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00572}00572         callout\_schedule(\&oct-\/>\mbox{\hyperlink{structocteon__device_a3c49e1c9c412e63782961819eec94a26}{console\_timer}}[console\_num].\mbox{\hyperlink{structlio__callout_af644c35302e054c86914dc14b0944e37}{timer}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00573}00573                          \mbox{\hyperlink{lio__bsd_8h_ae6eb6d875a682c72af6de3d0fa0876e5}{lio\_ms\_to\_ticks}}(\mbox{\hyperlink{lio__console_8c_a9ba54ebd0ba8b663917ad3320f829eef}{LIO\_CONSOLE\_POLL\_INTERVAL\_MS}}));}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00574}00574 \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00575}00575 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00576}00576 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00577}00577 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00578}\mbox{\hyperlink{lio__console_8c_aa0d11dee6603e2177f9673230f3ec26b}{00578}} \mbox{\hyperlink{lio__console_8c_aa0d11dee6603e2177f9673230f3ec26b}{lio\_init\_consoles}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structocteon__device}{octeon\_device}} *oct)}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00579}00579 \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00580}00580         uint64\_t        addr, size;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00581}00581         \textcolor{keywordtype}{int}             ret = 0;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00582}00582 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00583}00583         ret = \mbox{\hyperlink{lio__device_8c_a3afe7f956dd8bf370041885e845fa0b3}{lio\_mem\_access\_ok}}(oct);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00584}00584         \textcolor{keywordflow}{if} (ret) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00585}00585                 \mbox{\hyperlink{lio__bsd_8h_abe414f7d7854f53de3fe9db975df03db}{lio\_dev\_err}}(oct, \textcolor{stringliteral}{"{}Memory access not okay'\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00586}00586                 \textcolor{keywordflow}{return} (ret);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00587}00587         \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00588}00588         ret = \mbox{\hyperlink{lio__console_8c_a72055dc240dead97ba42ff0dde329a32}{lio\_named\_block\_find}}(oct, \mbox{\hyperlink{lio__console_8c_a061f25d7ebfb922c46ce2564ab4e1a7d}{LIO\_PCI\_CONSOLE\_BLOCK\_NAME}}, \&addr,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00589}00589                                    \&size);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00590}00590         \textcolor{keywordflow}{if} (ret) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00591}00591                 \mbox{\hyperlink{lio__bsd_8h_abe414f7d7854f53de3fe9db975df03db}{lio\_dev\_err}}(oct, \textcolor{stringliteral}{"{}Could not find console '\%s'\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00592}00592                             \mbox{\hyperlink{lio__console_8c_a061f25d7ebfb922c46ce2564ab4e1a7d}{LIO\_PCI\_CONSOLE\_BLOCK\_NAME}});}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00593}00593                 \textcolor{keywordflow}{return} (ret);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00594}00594         \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00595}00595 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00596}00596         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00597}00597 \textcolor{comment}{         * Use BAR1\_INDEX15 to create a static mapping to a region of}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00598}00598 \textcolor{comment}{         * Octeon's DRAM that contains the PCI console named block.}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00599}00599 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00600}00600         oct-\/>\mbox{\hyperlink{structocteon__device_af2e78949b445bb4de7f3051905614273}{console\_nb\_info}}.\mbox{\hyperlink{structocteon__device_a8c8a82a663de0d8a8b6ca367592ba31c}{bar1\_index}} = 15;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00601}00601         oct-\/>\mbox{\hyperlink{structocteon__device_a07eedda72ba39292f548957a394234dd}{fn\_list}}.\mbox{\hyperlink{structlio__fn__list_a9043bae39c669e11e2da1e201d07682b}{bar1\_idx\_setup}}(oct, addr, oct-\/>\mbox{\hyperlink{structocteon__device_af2e78949b445bb4de7f3051905614273}{console\_nb\_info}}.\mbox{\hyperlink{structocteon__device_a8c8a82a663de0d8a8b6ca367592ba31c}{bar1\_index}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00602}00602                                     1);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00603}00603         oct-\/>\mbox{\hyperlink{structocteon__device_af2e78949b445bb4de7f3051905614273}{console\_nb\_info}}.\mbox{\hyperlink{structocteon__device_ae883caf7a69c2d28a114a04e44341c5b}{dram\_region\_base}} = addr \& 0xFFFFFFFFFFC00000ULL;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00604}00604 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00605}00605         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00606}00606 \textcolor{comment}{         * num\_consoles > 0, is an indication that the consoles are}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00607}00607 \textcolor{comment}{         * accessible}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00608}00608 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00609}00609         oct-\/>\mbox{\hyperlink{structocteon__device_a21d617da26a191eacf2d88f2b0c67360}{num\_consoles}} = \mbox{\hyperlink{lio__mem__ops_8c_a93793dfe1384b5c18ff5b96b51d55a61}{lio\_read\_device\_mem32}}(oct,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00610}00610                                 addr + offsetof(\textcolor{keyword}{struct} \mbox{\hyperlink{structlio__pci__console__desc}{lio\_pci\_console\_desc}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00611}00611                                                 \mbox{\hyperlink{structocteon__device_a21d617da26a191eacf2d88f2b0c67360}{num\_consoles}}));}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00612}00612         oct-\/>\mbox{\hyperlink{structocteon__device_a49107214d048152d4e78417938dc3801}{console\_desc\_addr}} = addr;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00613}00613 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00614}00614         \mbox{\hyperlink{lio__bsd_8h_a1e6b64f2d951d285e7d956ce8cd5dd04}{lio\_dev\_dbg}}(oct, \textcolor{stringliteral}{"{}Initialized consoles. \%d available\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00615}00615                     oct-\/>\mbox{\hyperlink{structocteon__device_a21d617da26a191eacf2d88f2b0c67360}{num\_consoles}});}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00616}00616 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00617}00617         \textcolor{keywordflow}{return} (ret);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00618}00618 \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00619}00619 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00620}00620 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00621}\mbox{\hyperlink{lio__console_8c_ab15c65664cbe0cfdec60f705bc5eba7c}{00621}} \mbox{\hyperlink{lio__console_8c_ab15c65664cbe0cfdec60f705bc5eba7c}{lio\_add\_console}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structocteon__device}{octeon\_device}} *oct, uint32\_t console\_num, \textcolor{keywordtype}{char} *dbg\_enb)}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00622}00622 \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00623}00623         \textcolor{keyword}{struct }callout *timer;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00624}00624         \textcolor{keyword}{struct }\mbox{\hyperlink{structlio__console}{lio\_console}} *console;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00625}00625         uint64\_t        coreaddr;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00626}00626         \textcolor{keywordtype}{int}             ret = 0;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00627}00627 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00628}00628         \textcolor{keywordflow}{if} (console\_num >= oct-\/>\mbox{\hyperlink{structocteon__device_a21d617da26a191eacf2d88f2b0c67360}{num\_consoles}}) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00629}00629                 \mbox{\hyperlink{lio__bsd_8h_abe414f7d7854f53de3fe9db975df03db}{lio\_dev\_err}}(oct, \textcolor{stringliteral}{"{}trying to read from console number \%d when only 0 to \%d exist\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00630}00630                             console\_num, oct-\/>\mbox{\hyperlink{structocteon__device_a21d617da26a191eacf2d88f2b0c67360}{num\_consoles}});}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00631}00631         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00632}00632                 console = \&oct-\/>\mbox{\hyperlink{structocteon__device_af9094f8dfbf00973939ae87001b9c0db}{console}}[console\_num];}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00633}00633 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00634}00634                 console-\/>\mbox{\hyperlink{structlio__console_a8e6deee56edcd814c39c1caa5c7c7801}{waiting}} = 0;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00635}00635 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00636}00636                 coreaddr = oct-\/>\mbox{\hyperlink{structocteon__device_a49107214d048152d4e78417938dc3801}{console\_desc\_addr}} + console\_num * 8 +}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00637}00637                         offsetof(\textcolor{keyword}{struct} \mbox{\hyperlink{structlio__pci__console__desc}{lio\_pci\_console\_desc}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00638}00638                                  console\_addr\_array);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00639}00639                 console-\/>\mbox{\hyperlink{structlio__console_a3bedbbce0bf80047fbbb870343c817ec}{addr}} = \mbox{\hyperlink{lio__mem__ops_8c_aa1bf6312e87aa3edf0277d170a3500b5}{lio\_read\_device\_mem64}}(oct, coreaddr);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00640}00640                 coreaddr = console-\/>\mbox{\hyperlink{structlio__console_a3bedbbce0bf80047fbbb870343c817ec}{addr}} + offsetof(\textcolor{keyword}{struct} \mbox{\hyperlink{structlio__pci__console}{lio\_pci\_console}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00641}00641                                                     buf\_size);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00642}00642                 console-\/>\mbox{\hyperlink{structlio__console_a8d2dc316e8e19b5e61c17f1df8b0706c}{buffer\_size}} = \mbox{\hyperlink{lio__mem__ops_8c_a93793dfe1384b5c18ff5b96b51d55a61}{lio\_read\_device\_mem32}}(oct, coreaddr);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00643}00643                 coreaddr = console-\/>\mbox{\hyperlink{structlio__console_a3bedbbce0bf80047fbbb870343c817ec}{addr}} + offsetof(\textcolor{keyword}{struct} \mbox{\hyperlink{structlio__pci__console}{lio\_pci\_console}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00644}00644                                                     \mbox{\hyperlink{structlio__console_ae3cb9261146297be22e19898df45b9e8}{input\_base\_addr}});}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00645}00645                 console-\/>\mbox{\hyperlink{structlio__console_ae3cb9261146297be22e19898df45b9e8}{input\_base\_addr}} = \mbox{\hyperlink{lio__mem__ops_8c_aa1bf6312e87aa3edf0277d170a3500b5}{lio\_read\_device\_mem64}}(oct, coreaddr);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00646}00646                 coreaddr = console-\/>\mbox{\hyperlink{structlio__console_a3bedbbce0bf80047fbbb870343c817ec}{addr}} + offsetof(\textcolor{keyword}{struct} \mbox{\hyperlink{structlio__pci__console}{lio\_pci\_console}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00647}00647                                                     \mbox{\hyperlink{structlio__console_ad5ca48444f6562d5a08dca2aca3ce24e}{output\_base\_addr}});}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00648}00648                 console-\/>\mbox{\hyperlink{structlio__console_ad5ca48444f6562d5a08dca2aca3ce24e}{output\_base\_addr}} =}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00649}00649                         \mbox{\hyperlink{lio__mem__ops_8c_aa1bf6312e87aa3edf0277d170a3500b5}{lio\_read\_device\_mem64}}(oct, coreaddr);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00650}00650                 console-\/>\mbox{\hyperlink{structlio__console_a32b70267d933965a6eed0cd53b3580c2}{leftover}}[0] = \textcolor{charliteral}{'\(\backslash\)0'};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00651}00651 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00652}00652                 timer = \&oct-\/>\mbox{\hyperlink{structocteon__device_a3c49e1c9c412e63782961819eec94a26}{console\_timer}}[console\_num].\mbox{\hyperlink{structlio__callout_af644c35302e054c86914dc14b0944e37}{timer}};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00653}00653 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00654}00654                 \textcolor{keywordflow}{if} (oct-\/>\mbox{\hyperlink{structocteon__device_a2972de3e9e48ed2e4cc3720cf5ce7955}{uboot\_len}} == 0)}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00655}00655                         \mbox{\hyperlink{lio__console_8c_a989c365b922d8f961720c3ec9ecae6e0}{lio\_get\_uboot\_version}}(oct);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00656}00656 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00657}00657                 callout\_init(timer, 0);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00658}00658                 oct-\/>\mbox{\hyperlink{structocteon__device_a3c49e1c9c412e63782961819eec94a26}{console\_timer}}[console\_num].\mbox{\hyperlink{structlio__callout_a676a86b6589efe52e8c829d625a9bb94}{ctxptr}} = (\textcolor{keywordtype}{void} *)oct;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00659}00659                 oct-\/>\mbox{\hyperlink{structocteon__device_a3c49e1c9c412e63782961819eec94a26}{console\_timer}}[console\_num].\mbox{\hyperlink{structlio__callout_a448d5b78fdfaed4d87ac51ef90c34e0d}{ctxul}} = console\_num;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00660}00660                 callout\_reset(timer,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00661}00661                               \mbox{\hyperlink{lio__bsd_8h_ae6eb6d875a682c72af6de3d0fa0876e5}{lio\_ms\_to\_ticks}}(\mbox{\hyperlink{lio__console_8c_a9ba54ebd0ba8b663917ad3320f829eef}{LIO\_CONSOLE\_POLL\_INTERVAL\_MS}}),}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00662}00662                               \mbox{\hyperlink{lio__console_8c_ab1a6def6e82cf9c8b4df5b5226e1b142}{lio\_check\_console}}, timer);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00663}00663                 \textcolor{comment}{/* an empty string means use default debug console enablement */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00664}00664                 \textcolor{keywordflow}{if} (dbg\_enb \&\& !dbg\_enb[0])}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00665}00665                         dbg\_enb = \textcolor{stringliteral}{"{}setenv pci\_console\_active 1"{}};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00666}00666 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00667}00667                 \textcolor{keywordflow}{if} (dbg\_enb)}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00668}00668                         ret = \mbox{\hyperlink{lio__console_8c_ab5366969909f9cce5bd208c1271c4b19}{lio\_console\_send\_cmd}}(oct, dbg\_enb, 2000);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00669}00669 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00670}00670                 console-\/>\mbox{\hyperlink{structlio__console_a3f579153b71624c95841c4eb500ff81c}{active}} = 1;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00671}00671         \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00672}00672 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00673}00673         \textcolor{keywordflow}{return} (ret);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00674}00674 \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00675}00675 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00676}00676 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00677}00677 \textcolor{comment}{ * Removes all consoles}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00678}00678 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00679}00679 \textcolor{comment}{ * @param oct         octeon device}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00680}00680 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00681}00681 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00682}\mbox{\hyperlink{lio__console_8c_a298cdd9fe302f43e769044bc0f9130e0}{00682}} \mbox{\hyperlink{lio__console_8c_a298cdd9fe302f43e769044bc0f9130e0}{lio\_remove\_consoles}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structocteon__device}{octeon\_device}} *oct)}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00683}00683 \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00684}00684         \textcolor{keyword}{struct }\mbox{\hyperlink{structlio__console}{lio\_console}}   *console;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00685}00685         uint32\_t                i;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00686}00686 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00687}00687         \textcolor{keywordflow}{for} (i = 0; i < oct-\/>\mbox{\hyperlink{structocteon__device_a21d617da26a191eacf2d88f2b0c67360}{num\_consoles}}; i++) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00688}00688                 console = \&oct-\/>\mbox{\hyperlink{structocteon__device_af9094f8dfbf00973939ae87001b9c0db}{console}}[i];}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00689}00689 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00690}00690                 \textcolor{keywordflow}{if} (!console-\/>\mbox{\hyperlink{structlio__console_a3f579153b71624c95841c4eb500ff81c}{active}})}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00691}00691                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00692}00692 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00693}00693                 callout\_stop(\&oct-\/>\mbox{\hyperlink{structocteon__device_a3c49e1c9c412e63782961819eec94a26}{console\_timer}}[i].\mbox{\hyperlink{structlio__callout_af644c35302e054c86914dc14b0944e37}{timer}});}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00694}00694                 console-\/>\mbox{\hyperlink{structlio__console_a3bedbbce0bf80047fbbb870343c817ec}{addr}} = 0;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00695}00695                 console-\/>\mbox{\hyperlink{structlio__console_a8d2dc316e8e19b5e61c17f1df8b0706c}{buffer\_size}} = 0;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00696}00696                 console-\/>\mbox{\hyperlink{structlio__console_ae3cb9261146297be22e19898df45b9e8}{input\_base\_addr}} = 0;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00697}00697                 console-\/>\mbox{\hyperlink{structlio__console_ad5ca48444f6562d5a08dca2aca3ce24e}{output\_base\_addr}} = 0;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00698}00698         \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00699}00699 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00700}00700         oct-\/>\mbox{\hyperlink{structocteon__device_a21d617da26a191eacf2d88f2b0c67360}{num\_consoles}} = 0;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00701}00701 \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00702}00702 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00703}00703 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00704}\mbox{\hyperlink{lio__console_8c_ad19d8c1b63f1c4c2e734a729daf18233}{00704}} \mbox{\hyperlink{lio__console_8c_ad19d8c1b63f1c4c2e734a729daf18233}{lio\_console\_free\_bytes}}(uint32\_t \mbox{\hyperlink{structlio__console_a8d2dc316e8e19b5e61c17f1df8b0706c}{buffer\_size}}, uint32\_t wr\_idx, uint32\_t rd\_idx)}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00705}00705 \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00706}00706 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00707}00707         \textcolor{keywordflow}{if} (rd\_idx >= \mbox{\hyperlink{structlio__console_a8d2dc316e8e19b5e61c17f1df8b0706c}{buffer\_size}} || wr\_idx >= \mbox{\hyperlink{structlio__console_a8d2dc316e8e19b5e61c17f1df8b0706c}{buffer\_size}})}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00708}00708                 \textcolor{keywordflow}{return} (-\/1);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00709}00709 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00710}00710         \textcolor{keywordflow}{return} (((\mbox{\hyperlink{structlio__console_a8d2dc316e8e19b5e61c17f1df8b0706c}{buffer\_size}} -\/ 1) -\/ (wr\_idx -\/ rd\_idx)) \% \mbox{\hyperlink{structlio__console_a8d2dc316e8e19b5e61c17f1df8b0706c}{buffer\_size}});}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00711}00711 \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00712}00712 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00713}00713 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00714}\mbox{\hyperlink{lio__console_8c_aeaae18bea35f19407a0bc2685bccddc8}{00714}} \mbox{\hyperlink{lio__console_8c_aeaae18bea35f19407a0bc2685bccddc8}{lio\_console\_avail\_bytes}}(uint32\_t \mbox{\hyperlink{structlio__console_a8d2dc316e8e19b5e61c17f1df8b0706c}{buffer\_size}}, uint32\_t wr\_idx, uint32\_t rd\_idx)}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00715}00715 \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00716}00716 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00717}00717         \textcolor{keywordflow}{if} (rd\_idx >= \mbox{\hyperlink{structlio__console_a8d2dc316e8e19b5e61c17f1df8b0706c}{buffer\_size}} || wr\_idx >= \mbox{\hyperlink{structlio__console_a8d2dc316e8e19b5e61c17f1df8b0706c}{buffer\_size}})}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00718}00718                 \textcolor{keywordflow}{return} (-\/1);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00719}00719 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00720}00720         \textcolor{keywordflow}{return} (\mbox{\hyperlink{structlio__console_a8d2dc316e8e19b5e61c17f1df8b0706c}{buffer\_size}} -\/ 1 -\/}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00721}00721                 \mbox{\hyperlink{lio__console_8c_ad19d8c1b63f1c4c2e734a729daf18233}{lio\_console\_free\_bytes}}(\mbox{\hyperlink{structlio__console_a8d2dc316e8e19b5e61c17f1df8b0706c}{buffer\_size}}, wr\_idx, rd\_idx));}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00722}00722 \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00723}00723 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00724}00724 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00725}\mbox{\hyperlink{lio__console_8c_aaa6df0f3b5c13ba5909838a343de2a8b}{00725}} \mbox{\hyperlink{lio__console_8c_aaa6df0f3b5c13ba5909838a343de2a8b}{lio\_console\_read}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structocteon__device}{octeon\_device}} *oct, uint32\_t console\_num, \textcolor{keywordtype}{char} *buffer,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00726}00726                  uint32\_t buf\_size)}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00727}00727 \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00728}00728         \textcolor{keyword}{struct }\mbox{\hyperlink{structlio__console}{lio\_console}}   *console;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00729}00729         \textcolor{keywordtype}{int}                     bytes\_to\_read;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00730}00730         uint32\_t                rd\_idx, wr\_idx;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00731}00731 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00732}00732         \textcolor{keywordflow}{if} (console\_num >= oct-\/>\mbox{\hyperlink{structocteon__device_a21d617da26a191eacf2d88f2b0c67360}{num\_consoles}}) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00733}00733                 \mbox{\hyperlink{lio__bsd_8h_abe414f7d7854f53de3fe9db975df03db}{lio\_dev\_err}}(oct, \textcolor{stringliteral}{"{}Attempted to read from disabled console \%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00734}00734                             console\_num);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00735}00735                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00736}00736         \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00737}00737 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00738}00738         console = \&oct-\/>\mbox{\hyperlink{structocteon__device_af9094f8dfbf00973939ae87001b9c0db}{console}}[console\_num];}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00739}00739 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00740}00740         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00741}00741 \textcolor{comment}{         * Check to see if any data is available. Maybe optimize this with}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00742}00742 \textcolor{comment}{         * 64-\/bit read.}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00743}00743 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00744}00744         rd\_idx = \mbox{\hyperlink{lio__mem__ops_8c_a93793dfe1384b5c18ff5b96b51d55a61}{lio\_read\_device\_mem32}}(oct, console-\/>\mbox{\hyperlink{structlio__console_a3bedbbce0bf80047fbbb870343c817ec}{addr}} +}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00745}00745                        offsetof(\textcolor{keyword}{struct} \mbox{\hyperlink{structlio__pci__console}{lio\_pci\_console}}, output\_read\_index));}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00746}00746         wr\_idx = \mbox{\hyperlink{lio__mem__ops_8c_a93793dfe1384b5c18ff5b96b51d55a61}{lio\_read\_device\_mem32}}(oct, console-\/>\mbox{\hyperlink{structlio__console_a3bedbbce0bf80047fbbb870343c817ec}{addr}} +}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00747}00747                       offsetof(\textcolor{keyword}{struct} \mbox{\hyperlink{structlio__pci__console}{lio\_pci\_console}}, output\_write\_index));}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00748}00748 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00749}00749         bytes\_to\_read = \mbox{\hyperlink{lio__console_8c_aeaae18bea35f19407a0bc2685bccddc8}{lio\_console\_avail\_bytes}}(console-\/>\mbox{\hyperlink{structlio__console_a8d2dc316e8e19b5e61c17f1df8b0706c}{buffer\_size}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00750}00750                                                 wr\_idx, rd\_idx);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00751}00751         \textcolor{keywordflow}{if} (bytes\_to\_read <= 0)}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00752}00752                 \textcolor{keywordflow}{return} (bytes\_to\_read);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00753}00753 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00754}00754         bytes\_to\_read = min(bytes\_to\_read, buf\_size);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00755}00755 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00756}00756         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00757}00757 \textcolor{comment}{         * Check to see if what we want to read is not contiguous, and limit}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00758}00758 \textcolor{comment}{         * ourselves to the contiguous block}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00759}00759 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00760}00760         \textcolor{keywordflow}{if} (rd\_idx + bytes\_to\_read >= console-\/>\mbox{\hyperlink{structlio__console_a8d2dc316e8e19b5e61c17f1df8b0706c}{buffer\_size}})}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00761}00761                 bytes\_to\_read = console-\/>\mbox{\hyperlink{structlio__console_a8d2dc316e8e19b5e61c17f1df8b0706c}{buffer\_size}} -\/ rd\_idx;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00762}00762 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00763}00763         \mbox{\hyperlink{lio__mem__ops_8c_a45994a9251fc63e2f51c86b503773cce}{lio\_pci\_read\_core\_mem}}(oct, console-\/>\mbox{\hyperlink{structlio__console_ad5ca48444f6562d5a08dca2aca3ce24e}{output\_base\_addr}} + rd\_idx,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00764}00764                               (uint8\_t *) buffer, bytes\_to\_read);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00765}00765         \mbox{\hyperlink{lio__mem__ops_8c_ac4351e9029c6e41f375ce98a39ff83d4}{lio\_write\_device\_mem32}}(oct, console-\/>\mbox{\hyperlink{structlio__console_a3bedbbce0bf80047fbbb870343c817ec}{addr}} +}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00766}00766                                offsetof(\textcolor{keyword}{struct} \mbox{\hyperlink{structlio__pci__console}{lio\_pci\_console}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00767}00767                                         output\_read\_index),}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00768}00768                                (rd\_idx + bytes\_to\_read) \% console-\/>\mbox{\hyperlink{structlio__console_a8d2dc316e8e19b5e61c17f1df8b0706c}{buffer\_size}});}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00769}00769 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00770}00770         \textcolor{keywordflow}{return} (bytes\_to\_read);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00771}00771 \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00772}00772 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00773}00773 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00774}\mbox{\hyperlink{lio__console_8c_a989c365b922d8f961720c3ec9ecae6e0}{00774}} \mbox{\hyperlink{lio__console_8c_a989c365b922d8f961720c3ec9ecae6e0}{lio\_get\_uboot\_version}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structocteon__device}{octeon\_device}} *oct)}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00775}00775 \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00776}00776         \textcolor{keyword}{struct }\mbox{\hyperlink{structlio__console}{lio\_console}} *console;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00777}00777         int32\_t         bytes\_read, total\_read, tries;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00778}00778         uint32\_t        console\_num = 0;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00779}00779         \textcolor{keywordtype}{int}             i, ret = 0;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00780}00780 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00781}00781         ret = \mbox{\hyperlink{lio__console_8c_ab5366969909f9cce5bd208c1271c4b19}{lio\_console\_send\_cmd}}(oct, \textcolor{stringliteral}{"{}setenv stdout pci"{}}, 50);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00782}00782 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00783}00783         console = \&oct-\/>\mbox{\hyperlink{structocteon__device_af9094f8dfbf00973939ae87001b9c0db}{console}}[console\_num];}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00784}00784         tries = 0;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00785}00785         total\_read = 0;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00786}00786 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00787}00787         ret = \mbox{\hyperlink{lio__console_8c_ab5366969909f9cce5bd208c1271c4b19}{lio\_console\_send\_cmd}}(oct, \textcolor{stringliteral}{"{}version"{}}, 1);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00788}00788 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00789}00789         \textcolor{keywordflow}{do} \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00790}00790                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00791}00791 \textcolor{comment}{                 * Take console output regardless of whether it will be}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00792}00792 \textcolor{comment}{                 * logged}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00793}00793 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00794}00794                 bytes\_read = \mbox{\hyperlink{lio__console_8c_aaa6df0f3b5c13ba5909838a343de2a8b}{lio\_console\_read}}(oct,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00795}00795                                               console\_num, oct-\/>\mbox{\hyperlink{structocteon__device_ab6648b20e6ccf3a649f5cd46defac259}{uboot\_version}} +}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00796}00796                                               total\_read,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00797}00797                                               \mbox{\hyperlink{lio__device_8h_aeeac0ed1e1d4f4d5a98a1c2f8ae2b6d7}{OCTEON\_UBOOT\_BUFFER\_SIZE}} -\/ 1 -\/}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00798}00798                                               total\_read);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00799}00799                 \textcolor{keywordflow}{if} (bytes\_read > 0) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00800}00800                         oct-\/>\mbox{\hyperlink{structocteon__device_ab6648b20e6ccf3a649f5cd46defac259}{uboot\_version}}[bytes\_read] = 0x0;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00801}00801 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00802}00802                         total\_read += bytes\_read;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00803}00803                         \textcolor{keywordflow}{if} (console-\/>\mbox{\hyperlink{structlio__console_a8e6deee56edcd814c39c1caa5c7c7801}{waiting}})}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00804}00804                                 \mbox{\hyperlink{lio__console_8c_a1b07b5c98da17405593e2bd965a9b963}{lio\_console\_handle\_result}}(oct, console\_num);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00805}00805 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00806}00806                 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (bytes\_read < 0) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00807}00807                         \mbox{\hyperlink{lio__bsd_8h_abe414f7d7854f53de3fe9db975df03db}{lio\_dev\_err}}(oct, \textcolor{stringliteral}{"{}Error reading console \%u, ret=\%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00808}00808                                     console\_num, bytes\_read);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00809}00809                 \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00810}00810 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00811}00811                 tries++;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00812}00812         \} \textcolor{keywordflow}{while} ((bytes\_read > 0) \&\& (tries < 16));}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00813}00813 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00814}00814         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00815}00815 \textcolor{comment}{         * If nothing is read after polling the console, output any leftovers}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00816}00816 \textcolor{comment}{         * if any}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00817}00817 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00818}00818         \textcolor{keywordflow}{if} ((total\_read == 0) \&\& (console-\/>\mbox{\hyperlink{structlio__console_a32b70267d933965a6eed0cd53b3580c2}{leftover}}[0])) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00819}00819                 \mbox{\hyperlink{lio__bsd_8h_a1e6b64f2d951d285e7d956ce8cd5dd04}{lio\_dev\_dbg}}(oct, \textcolor{stringliteral}{"{}\%u: \%s\(\backslash\)n"{}}, console\_num, console-\/>\mbox{\hyperlink{structlio__console_a32b70267d933965a6eed0cd53b3580c2}{leftover}});}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00820}00820                 console-\/>\mbox{\hyperlink{structlio__console_a32b70267d933965a6eed0cd53b3580c2}{leftover}}[0] = \textcolor{charliteral}{'\(\backslash\)0'};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00821}00821         \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00822}00822 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00823}00823         ret = \mbox{\hyperlink{lio__console_8c_ab5366969909f9cce5bd208c1271c4b19}{lio\_console\_send\_cmd}}(oct, \textcolor{stringliteral}{"{}setenv stdout serial"{}}, 50);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00824}00824 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00825}00825         \textcolor{comment}{/* U-\/Boot */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00826}00826         \textcolor{keywordflow}{for} (i = 0; i < (\mbox{\hyperlink{lio__device_8h_aeeac0ed1e1d4f4d5a98a1c2f8ae2b6d7}{OCTEON\_UBOOT\_BUFFER\_SIZE}} -\/ 9); i++) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00827}00827                 \textcolor{keywordflow}{if} (oct-\/>\mbox{\hyperlink{structocteon__device_ab6648b20e6ccf3a649f5cd46defac259}{uboot\_version}}[i] == \textcolor{charliteral}{'U'} \&\&}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00828}00828                     oct-\/>\mbox{\hyperlink{structocteon__device_ab6648b20e6ccf3a649f5cd46defac259}{uboot\_version}}[i + 2] == \textcolor{charliteral}{'B'} \&\&}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00829}00829                     oct-\/>\mbox{\hyperlink{structocteon__device_ab6648b20e6ccf3a649f5cd46defac259}{uboot\_version}}[i + 3] == \textcolor{charliteral}{'o'} \&\&}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00830}00830                     oct-\/>\mbox{\hyperlink{structocteon__device_ab6648b20e6ccf3a649f5cd46defac259}{uboot\_version}}[i + 4] == \textcolor{charliteral}{'o'} \&\&}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00831}00831                     oct-\/>\mbox{\hyperlink{structocteon__device_ab6648b20e6ccf3a649f5cd46defac259}{uboot\_version}}[i + 5] == \textcolor{charliteral}{'t'}) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00832}00832                         oct-\/>\mbox{\hyperlink{structocteon__device_a381f05159690a970929082919913b221}{uboot\_sidx}} = i;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00833}00833                         i++;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00834}00834                         \textcolor{keywordflow}{for} (; oct-\/>\mbox{\hyperlink{structocteon__device_ab6648b20e6ccf3a649f5cd46defac259}{uboot\_version}}[i] != 0x0; i++) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00835}00835                                 \textcolor{keywordflow}{if} (oct-\/>\mbox{\hyperlink{structocteon__device_ab6648b20e6ccf3a649f5cd46defac259}{uboot\_version}}[i] == \textcolor{charliteral}{'m'} \&\&}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00836}00836                                     oct-\/>\mbox{\hyperlink{structocteon__device_ab6648b20e6ccf3a649f5cd46defac259}{uboot\_version}}[i + 1] == \textcolor{charliteral}{'i'} \&\&}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00837}00837                                     oct-\/>\mbox{\hyperlink{structocteon__device_ab6648b20e6ccf3a649f5cd46defac259}{uboot\_version}}[i + 2] == \textcolor{charliteral}{'p'} \&\&}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00838}00838                                     oct-\/>\mbox{\hyperlink{structocteon__device_ab6648b20e6ccf3a649f5cd46defac259}{uboot\_version}}[i + 3] == \textcolor{charliteral}{'s'}) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00839}00839                                         oct-\/>\mbox{\hyperlink{structocteon__device_a1aa3c12a6e7bd536751c29721287750b}{uboot\_eidx}} = i -\/ 1;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00840}00840                                         oct-\/>\mbox{\hyperlink{structocteon__device_ab6648b20e6ccf3a649f5cd46defac259}{uboot\_version}}[i -\/ 1] = 0x0;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00841}00841                                         oct-\/>\mbox{\hyperlink{structocteon__device_a2972de3e9e48ed2e4cc3720cf5ce7955}{uboot\_len}} = oct-\/>\mbox{\hyperlink{structocteon__device_a1aa3c12a6e7bd536751c29721287750b}{uboot\_eidx}} -\/}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00842}00842                                                 oct-\/>\mbox{\hyperlink{structocteon__device_a381f05159690a970929082919913b221}{uboot\_sidx}} + 1;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00843}00843                                         \mbox{\hyperlink{lio__bsd_8h_ae98de25aa714ca601589b31d9364062a}{lio\_dev\_info}}(oct, \textcolor{stringliteral}{"{}\%s\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00844}00844                                                      \&oct-\/>\mbox{\hyperlink{structocteon__device_ab6648b20e6ccf3a649f5cd46defac259}{uboot\_version}}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00845}00845                                                      [oct-\/>\mbox{\hyperlink{structocteon__device_a381f05159690a970929082919913b221}{uboot\_sidx}}]);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00846}00846                                         \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00847}00847                                 \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00848}00848                         \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00849}00849                 \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00850}00850         \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00851}00851 \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00852}00852 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00853}00853 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00854}\mbox{\hyperlink{lio__console_8c_a3461614bbf80ee0af40f7ee45a7262bf}{00854}} \textcolor{preprocessor}{\#define FBUF\_SIZE       (4 * 1024 * 1024)}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00855}00855 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00856}00856 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00857}\mbox{\hyperlink{lio__console_8c_ac0683f2249537b8e2e3153732f7c5fb9}{00857}} \mbox{\hyperlink{lio__console_8c_ac0683f2249537b8e2e3153732f7c5fb9}{lio\_download\_firmware}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structocteon__device}{octeon\_device}} *oct, \textcolor{keyword}{const} uint8\_t * data,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00858}00858                       \textcolor{keywordtype}{size\_t} size)}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00859}00859 \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00860}00860         \textcolor{keyword}{struct }\mbox{\hyperlink{structlio__firmware__file__header}{lio\_firmware\_file\_header}} *h;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00861}00861         uint64\_t        load\_addr;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00862}00862         uint32\_t        crc32\_result, i, image\_len, rem;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00863}00863         \textcolor{keywordtype}{int}             ret = 0;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00864}00864 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00865}00865         \textcolor{keywordflow}{if} (size < \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} \mbox{\hyperlink{structlio__firmware__file__header}{lio\_firmware\_file\_header}})) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00866}00866                 \mbox{\hyperlink{lio__bsd_8h_abe414f7d7854f53de3fe9db975df03db}{lio\_dev\_err}}(oct, \textcolor{stringliteral}{"{}Firmware file too small (\%d < \%d).\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00867}00867                             (uint32\_t) size,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00868}00868                             (uint32\_t) \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} \mbox{\hyperlink{structlio__firmware__file__header}{lio\_firmware\_file\_header}}));}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00869}00869                 \textcolor{keywordflow}{return} (-\/EINVAL);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00870}00870         \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00871}00871 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00872}00872         h = \_\_DECONST(\textcolor{keyword}{struct} \mbox{\hyperlink{structlio__firmware__file__header}{lio\_firmware\_file\_header}} *, data);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00873}00873 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00874}00874         \textcolor{keywordflow}{if} (be32toh(h-\/>\mbox{\hyperlink{structlio__firmware__file__header_a4ff19f5fd36b1f0e3e4b175c176b7bda}{magic}}) != \mbox{\hyperlink{lio__image_8h_ad73a432d67b57f31a610a68f65c0aa86}{LIO\_NIC\_MAGIC}}) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00875}00875                 \mbox{\hyperlink{lio__bsd_8h_abe414f7d7854f53de3fe9db975df03db}{lio\_dev\_err}}(oct, \textcolor{stringliteral}{"{}Unrecognized firmware file.\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00876}00876                 \textcolor{keywordflow}{return} (-\/EINVAL);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00877}00877         \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00878}00878 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00879}00879         crc32\_result = \mbox{\hyperlink{structlio__firmware__file__header_a91ebd046d6d84a92af623013f30fb51e}{crc32}}(data, \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} \mbox{\hyperlink{structlio__firmware__file__header}{lio\_firmware\_file\_header}}) -\/}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00880}00880                              \textcolor{keyword}{sizeof}(uint32\_t));}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00881}00881         \textcolor{keywordflow}{if} (crc32\_result != be32toh(h-\/>\mbox{\hyperlink{structlio__firmware__file__header_a91ebd046d6d84a92af623013f30fb51e}{crc32}})) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00882}00882                 \mbox{\hyperlink{lio__bsd_8h_abe414f7d7854f53de3fe9db975df03db}{lio\_dev\_err}}(oct, \textcolor{stringliteral}{"{}Firmware CRC mismatch (0x\%08x != 0x\%08x).\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00883}00883                             crc32\_result, be32toh(h-\/>\mbox{\hyperlink{structlio__firmware__file__header_a91ebd046d6d84a92af623013f30fb51e}{crc32}}));}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00884}00884                 \textcolor{keywordflow}{return} (-\/EINVAL);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00885}00885         \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00886}00886 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00887}00887         \textcolor{keywordflow}{if} (memcmp(\mbox{\hyperlink{lio__common_8h_a7842a79e9711fd834ba221a3ebeb5184}{LIO\_BASE\_VERSION}}, h-\/>\mbox{\hyperlink{structlio__firmware__file__header_acc7835332b865c2f6e1250075df0a515}{version}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00888}00888                    strlen(\mbox{\hyperlink{lio__common_8h_a7842a79e9711fd834ba221a3ebeb5184}{LIO\_BASE\_VERSION}}))) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00889}00889                 \mbox{\hyperlink{lio__bsd_8h_abe414f7d7854f53de3fe9db975df03db}{lio\_dev\_err}}(oct, \textcolor{stringliteral}{"{}Unmatched firmware version. Expected \%s.x, got \%s.\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00890}00890                             \mbox{\hyperlink{lio__common_8h_a7842a79e9711fd834ba221a3ebeb5184}{LIO\_BASE\_VERSION}}, h-\/>\mbox{\hyperlink{structlio__firmware__file__header_acc7835332b865c2f6e1250075df0a515}{version}});}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00891}00891                 \textcolor{keywordflow}{return} (-\/EINVAL);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00892}00892         \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00893}00893 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00894}00894         \textcolor{keywordflow}{if} (be32toh(h-\/>\mbox{\hyperlink{structlio__firmware__file__header_a4e4f5523f7112432e0028a8ba4692daf}{num\_images}}) > \mbox{\hyperlink{lio__image_8h_af34cda13c5e752c16526180113bbadbe}{LIO\_MAX\_IMAGES}}) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00895}00895                 \mbox{\hyperlink{lio__bsd_8h_abe414f7d7854f53de3fe9db975df03db}{lio\_dev\_err}}(oct, \textcolor{stringliteral}{"{}Too many images in firmware file (\%d).\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00896}00896                             be32toh(h-\/>\mbox{\hyperlink{structlio__firmware__file__header_a4e4f5523f7112432e0028a8ba4692daf}{num\_images}}));}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00897}00897                 \textcolor{keywordflow}{return} (-\/EINVAL);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00898}00898         \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00899}00899 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00900}00900         \mbox{\hyperlink{lio__bsd_8h_ae98de25aa714ca601589b31d9364062a}{lio\_dev\_info}}(oct, \textcolor{stringliteral}{"{}Firmware version: \%s\(\backslash\)n"{}}, h-\/>\mbox{\hyperlink{structlio__firmware__file__header_acc7835332b865c2f6e1250075df0a515}{version}});}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00901}00901         snprintf(oct-\/>\mbox{\hyperlink{structocteon__device_ac02b5516bad1e266bfdae40d713650f6}{fw\_info}}.\mbox{\hyperlink{structlio__fw__info_a6591b7507fb758d905e5e81f34d405b2}{lio\_firmware\_version}}, 32, \textcolor{stringliteral}{"{}LIQUIDIO: \%s"{}},}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00902}00902                  h-\/>\mbox{\hyperlink{structlio__firmware__file__header_acc7835332b865c2f6e1250075df0a515}{version}});}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00903}00903 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00904}00904         data += \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct }\mbox{\hyperlink{structlio__firmware__file__header}{lio\_firmware\_file\_header}});}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00905}00905 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00906}00906         \mbox{\hyperlink{lio__bsd_8h_ae98de25aa714ca601589b31d9364062a}{lio\_dev\_info}}(oct, \textcolor{stringliteral}{"{}Loading \%d image(s)\(\backslash\)n"{}}, be32toh(h-\/>\mbox{\hyperlink{structlio__firmware__file__header_a4e4f5523f7112432e0028a8ba4692daf}{num\_images}}));}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00907}00907 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00908}00908         \textcolor{comment}{/* load all images */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00909}00909         \textcolor{keywordflow}{for} (i = 0; i < be32toh(h-\/>\mbox{\hyperlink{structlio__firmware__file__header_a4e4f5523f7112432e0028a8ba4692daf}{num\_images}}); i++) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00910}00910                 load\_addr = be64toh(h-\/>\mbox{\hyperlink{structlio__firmware__file__header_a843d5cef7017b225e1acf37fda309ac0}{desc}}[i].\mbox{\hyperlink{structlio__firmware__desc_a97aea473f680f6eccf8a86205712f4c8}{addr}});}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00911}00911                 image\_len = be32toh(h-\/>\mbox{\hyperlink{structlio__firmware__file__header_a843d5cef7017b225e1acf37fda309ac0}{desc}}[i].\mbox{\hyperlink{structlio__firmware__desc_ad1e6f9e9dc6ca7c902a7a2c775df8379}{len}});}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00912}00912 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00913}00913                 \mbox{\hyperlink{lio__bsd_8h_ae98de25aa714ca601589b31d9364062a}{lio\_dev\_info}}(oct, \textcolor{stringliteral}{"{}Loading firmware \%d at \%llx\(\backslash\)n"{}}, image\_len,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00914}00914                              (\textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{long} \textcolor{keywordtype}{long})load\_addr);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00915}00915 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00916}00916                 \textcolor{comment}{/* Write in 4MB chunks */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00917}00917                 rem = image\_len;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00918}00918 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00919}00919                 \textcolor{keywordflow}{while} (rem) \{}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00920}00920                         \textcolor{keywordflow}{if} (rem < \mbox{\hyperlink{lio__console_8c_a3461614bbf80ee0af40f7ee45a7262bf}{FBUF\_SIZE}})}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00921}00921                                 size = rem;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00922}00922                         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00923}00923                                 size = \mbox{\hyperlink{lio__console_8c_a3461614bbf80ee0af40f7ee45a7262bf}{FBUF\_SIZE}};}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00924}00924 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00925}00925                         \textcolor{comment}{/* download the image */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00926}00926                         \mbox{\hyperlink{lio__mem__ops_8c_a1369fd16acd4008689763e9a39154db3}{lio\_pci\_write\_core\_mem}}(oct, load\_addr,}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00927}00927                                                \_\_DECONST(uint8\_t *, data),}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00928}00928                                                (uint32\_t) size);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00929}00929 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00930}00930                         data += size;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00931}00931                         rem -\/= (uint32\_t) size;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00932}00932                         load\_addr += size;}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00933}00933                 \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00934}00934         \}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00935}00935 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00936}00936         \mbox{\hyperlink{lio__bsd_8h_ae98de25aa714ca601589b31d9364062a}{lio\_dev\_info}}(oct, \textcolor{stringliteral}{"{}Writing boot command: \%s\(\backslash\)n"{}}, h-\/>\mbox{\hyperlink{structlio__firmware__file__header_ab4c9f1d5a7c0f601e586b2f136a9ac0e}{bootcmd}});}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00937}00937 }
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00938}00938         \textcolor{comment}{/* Invoke the bootcmd */}}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00939}00939         ret = \mbox{\hyperlink{lio__console_8c_ab5366969909f9cce5bd208c1271c4b19}{lio\_console\_send\_cmd}}(oct, h-\/>\mbox{\hyperlink{structlio__firmware__file__header_ab4c9f1d5a7c0f601e586b2f136a9ac0e}{bootcmd}}, 50);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00940}00940         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{lio__console_8c_source_l00941}00941 \}}

\end{DoxyCode}
