Annotation of qemu/pc-bios/slof.bin, revision 1.1.1.3

1.1.1.3 ! root        1: ��(headermagic123
opdwgqemu0 21ȏ�(����������Ð&(stage1H?ޭ��?||C�|  �|C�|�|C��`|     �8N� A@|C�|     �|C�|�|C���|     �8�N� A@|C�|     �|C�|�|C��`|     �8N� A@|C�|     �|C�|�|C���|     �8�N� A@|C�|     �|C�|�|C��`|     �8N� A@|C�|     �|C�|�|C���|     �8�N� A@|C�|     �|C�|�|C��`|     �8N� A@|C�|     �|C�|�|C��`|     �8N� A@|C�|     �|C�|�|C��`|     �8N� A@|C�|     �|C�|�|C��`|     �8N� A@|C�|     �|C�|�|C��        `|      �8    N� A@|C�|  �|C�|�|C��
1.1       root        2: `|     �8
1.1.1.3 ! root        3: N� A@|C�| �|C�|�|C��`|     �8N� A@|C�|     �|C�|�|C��`|     �8N� A@|C�|     �|C�|�|C��
`|     �8
N� A@|C�|     �|C�|�|C��`|     �8N� A@|C�|     �|C�|�|C��`|     �8N� A@|C�|     �|C�|�|C��`|     �8N� A@|C�|     �|C�|�|C��`|     �8N� A@|C�|     �|C�|�|C��`|     �8N� A@|C�|     �|C�|�|C��`|     �8N� A@|C�|     �|C�|�|C��`|     �8N� A@|C�|     �|C�|�|C��`|     �8N� A@|C�|     �|C�|�|C��`|     �8N� A@|C�|     �|C�|�|C��`|     �8N� A@|C�|     �|C�|�|C��`|     �8N� A@|C�|     �|C�|�|C��`|     �8N� A@|C�|     �|C�|�|C��`|     �8N� A@|C�|     �|C�|�|C��`|     �8N� A@|C�|     �|C�|�|C��`|     �8N� A@|C�|     �|C�|�|C��`|     �8N� A@|C�|     �|C�|�|C��`|     �8N� A@|C�|     �|C�|�|C��`|     �8N� A@|C�|     �|C�|�|C�� `|     �8 N� A@|C�|     �|C�|�|C��!`|     �8!N� A@|C�|     �|C�|�|C��"`|     �8"N� A@|C�|     �|C�|�|C��#`|     �8#N� A@|C�|     �|C�|�|C��$`|     �8$N� A@|C�|     �|C�|�|C��%`|     �8%N� A@|C�|     �|C�|�|C��&`|     �8&N� A@|C�|     �|C�|�|C��'`|     �8'N� A@|C�|     �|C�|�|C��(`|     �8(N� A@|C�|     �|C�|�|C��)`|     �8)N� A@|C�|     �|C�|�|C��*`|     �8*N� A@|C�|     �|C�|�|C��+`|     �8+N� A@|C�|     �|C�|�|C��,`|     �8,N� A@|C�|     �|C�|�|C��-`|     �8-N� A@|C�|     �|C�|�|C��.`|     �8.N� A@|C�|     �|C�|�|C��/`|     �8/N� A@|x}`�9��y���}kcx}`&dL&,8`
        !             4: HE8`
H=8`
        !             5: H58`SH-8`LH%8`OH8`FHHq8`I|i�N�!xf��8`X8�8�&D"N� git-d153364253548d6c�b��#�A@�aH�P�X��`��h�&p�!x�A��a������������&��!��A��a������������&��!��A&�a&�&�&��& ��&(��&8}����&@}����&H}�� �/�|      ��&0�!8N� |)�< �!���A@�aH��P��X��`��h�&p�!x�A��a��������������&��!��A��a��������������&��!��A&�a&��&��&��& ��&(�&0}����8}����&8}����&@}�&��&H}����&PH��b��#|xH
        !             6: ���&8}����&@}����&H}�� ��&P}���A@�aH�P�X��`��h�&p�!x�A��a������������&��!��A��a������������&��!��A&�a&�&�&��& ��&(�!8|B�|     �|B�|�|B�L$���`N� H�[?25l **********************************************************************
1.1       root        7: QEMU Starting
1.1.1.3 ! root        8:  Build Date = Feb 17 2012 11:32:27
        !             9:  FW Version = git-d153364253548d6c
        !            10: |h�HAK���
1.1       root       11: 
                     12: 
E1001 - Boot ROM CRC failure
                     13: 

                     14: 
                     15: 
E1002 - Memory could not be initialized
                     16: 

                     17: 
                     18: 
E1003 - Firmware image incomplete
                     19: 
       internal FLS1-FFS-0.
                     20: 
                     21: 
E1004 - Unspecified Internal Firmware Error
                     22: 
       internal FLSX-SE-0.|x|�#x|�+x|�3x9@&s�
                     23: @�(��x|�J�|c#xH&���x;�|#�A�H�H}��|�#x8�|#8A�H�}B�,A�4Hx��}B�8�|'0A�8��|' 8`&A�P|�#x|qB���8�|' A�|����������|���(8� �� 8`~�x}��N� }��|�+x|�+xH9,&@�}��N� |��:��8����E&�P&B��~%�x}��N� }(�|�#x|jx|�#x8� |�+xHE,&@� �,|�*@���8`&}(�N� 8`�����|�B}(�N� 9J��9k���        ��     |-p9�&A�N� q��@���9�N� �!��|��&0��8��@��H|�+xK��Y�&0|����������H��@��88!PN� }�|ix�i,A�H     9)&K���}�N� }�|ixy#' pc,
                     24: A�8c8c0H&�y#F pc,
                     25: A�8c8c0H&�y#e pc,
                     26: A�8c8c0H&�y#� pc,
                     27: A�8c8c0H&�y#� pc,
                     28: A�8c8c0H&ey#� pc,
                     29: A�8c8c0H&Iy#� pc,
                     30: A�8c8c0H&-y#"pc,
                     31: A�8c8c0H&y#'pc,
                     32: A�8c8c0H�y#Fpc,
                     33: A�8c8c0H�y#epc,
                     34: A�8c8c0H�y#�pc,
                     35: A�8c8c0H�y#�pc,
                     36: A�8c8c0H�y#�pc,
                     37: A�8c8c0Hiy#�pc,
                     38: A�8c8c0HMy#pc,
1.1.1.3 ! root       39: A�8c8c0H1}�N� }�|ixK��}�|ixK��t}�|ixK���xf��8`X8�8�&D"N� |jx8`T8�D"|�#yA�x�F �jN� <``cxc�dc`cp�<�`�x��d�`�R�T���A�8�|����    B��< `!x!�d!`!�8a�|��H58`��xH�< `!x!�d!`!�8!��a|h�N� <@`BxB�dB`BØ8B@8B@N� |fx8`&8�&<�`�DXK���|�8�Tc0T�0|� PT���|��|l|�|�|�L&,8c�B��N� ``|`>p�"�|�x$|�&*N� ```|���������|�#y�a���&|{x���������!�&A�&�?���8�{��<�@��x;��H�`�"� �b�(8�   H�`�b�0��x��xK���`|dy@�&��!�낀@��x8����x�iK��m`/�A���b�H��xHq`�b�P��x��xK��A`|dy@�& <��4�&@�&,��`�a�;�p8���xH�`�b�h肀p袀xH`�&p�&xL&,|��A(�&p<�eP��x��x`�AP�a�8���x|     ��^N�!�A(L&,|�8!&�&�a��������|���������N� �����8`&H�`�a�9 &}kJ9kU)0Uk0}iXPUk��}i�|Hl|�|O�|�L&,9)�B���b�P��x��xK��%`|dyA����b�8H-`<��4�&A����b�X���Hq`��K����b�H]`K���b�8H�`K��D&�`|��"�����|dx�&�!��x`��x$� �})*/�A�4� �A(| ��i�IN�!�A(8!��&����|�N� 9 /��     /�@�t�b��HY`|���b��|�#xx�"HA`|���b��|�#xx�"H)`|�B��b��|�#xx�"H`|�B��b��|�#xx�"H�`HK���`�K���&�&|��&�����!��|?x|`x����x |xK���`8?��&|�����N� &�&&|��&�����!�q|?x|ix���|�+x�?������p��/�&A���/�A�8Hx8�xHT�p| x�     x /�
        !            40: @�8`
K��9�p|      x�     x �?p9)&�?p|xK���x0&�x�?x���@A����xx |x8?��&|�����N� &�&&|����p���x|�#x�&�&��|`x�!���A���!�&|x}CxK���`8!&�&���p���x�&��|��!���A��N� &�8���8���|�*��8��|�*��<�`�x��d�ib`�m,|�(P|�*�<�CP`�U0x��d�lo`�g|�(P|�*��8���|�*��8�|�*+�A�8�&|ex|�#x|�+xN� }�|dx8`8�/�A�8�|�#xH��&�0A�`�&/�@�`�&|�#xK��-/�A�`�|�;x}�N� }(�K���}(�/�|�#x@�|8`N� }(�8��|�28�Q8������8�@8�����8�&<�ib`�m,����<�CP`�U1x��d�lo`�g��|�3xH&]�f&}(�N� }�|gxHm8�Q8�����8�@8�����8�&<�ib`�m,����<�CP`�U0x��d�lo`�g��H��g&K��1|�;x8`&}�N� <�`�x��d�&`�x���|��8�<�`�x��d�`�|�)*8�B��N� <�`�x��d�`���x�&�8����0A�8�8�&��8���|�*�f@N� 8��|�"<�`�x��d�`����x�&�8����0A�8�8�&��8���|�*�f@N� |fx�f<�`�x��d�`�|�0�8�&|�x� �@+$@�8�&x� |�+xA���|�3xN� |��&�!���cm`E/�LFA�8!p8`���&|�N� �/�@���c8��T>+�&A��Сc8��T>+�&A����/�&A�$/�@���HI`8!p�&|�N� H�`8!p�&|�N� &�```|�=`E��������|�#x�&�!��akLF;�����XA�$8!���x�&��������|�N� `�;���/�@��Ԡ;���0��T>+�&A����;���0��T>+�&A�����/�&A�8/�@���8�H�`8!��~��x�&��������|�N� 8�H]`8!��~��x�&��������|�N� &�``|�= E�A���a��|�3x�&����a)LF|�#x��������|�;x|�+x�����!�a|x;�����HA�48!���x�&�A���a�����|������������N� `�;���/�@��Ġ;���0��T>+�&A����;���0��T>+�&A�����/�&A�t/�@���H`E�xf�x��P��x��xH1`��x���x��Hi`8!���x�&�A���a�����|������������N� He`E�xf�x��P��x��xH�`8!�����x�&�A�����a��|���������������N� &����,}C|./�&A�L�*9`}*BH ``�     }*Kx})B/�&A� 9k&}k��8@���8`N� `�jN� ```|�}�&�&����.%-������&��|�3x�A���a��|�#x;`��������|�+x|}x�����!��;����!�A����H,```�,;�&�����*A����/�&@���/�A�&�?9��A�0��A(#�x|     ����|�\N�!�A(/�@�����|��#�xHy`��?8�|y|HPx H�`��/�A��XA��T��A(#�x;�&��| ��w�WN�!�A(�,���*@��4``8!��`��&��{c �����&��|��!���A��}�& �a�����}�� �����������N� `�?�{�P{�K���� � ��8}C|./�&A�L�69`}*BH ``�     }*Kx})B/�&A� 9k&}k��8@���8`N� `�jN� ```|��!���A���&�a��|�#x��������;���������|x�!�Q�#(#�>�xH(```;�&�<;�@����A��/�@����>,�^(y)6d}9J{Z6dY��     x     ��A���� /�A����_ ��8;��z��8|�2|�2|P.}_R/�&�A��``�69`}*BH� }*Kx})B/�&A��9k&}k��8@���|0*x�"y+.�y)$})XP�ex� |i+�@|�#}+J}`�})�@���b��Hm`� �8����`@��x@����_ ���z��8|�2|�2|P.}_R/�&�@��@```|0*�*�@@��\�b��H�`� K���```�B��x�d|
        !            41: �}@R}I�N� ���X&���X���X&&d&P���X���X���X���h���h���X���X���X���X���X���X���X���X���X���X���X���X���X���X���X���X���X���X���X���X���X���X���X���X���X���X&D&8���X&,���X���X���h���X���X���h���h���h���h&���X���X���X���X���X&���h���h���X���X���X���h���hU):�+K��\�+K��T�|��� K��@y)� �+K��4y)"�+K��(�+� K��y �y)��|        �K��y)��+K���``8!��&�!���A���a��|���������������N� &�``|�}�&�&����.%-������&��|�3x�A���a��|�#x;`��������|�+x|}x�����!��;����!�A�� ��H,```�8;�&�����6A����/�&@���/�A�&�?9��A�0��A(#�x|     ��(�|�\N�!�A(/�@�����$|��#�xH&y`� �?(8�|y|HPx H�`�(/�A��XA��T��A(#�x;�&��| ��w�WN�!�A(�8���6@��4``8!��}|{�&�������&��|��!���A��}�& �a�����}�� �����������N� ``�?�{�PK����     ,%M� 8���x� x� |ix8�&|����9)&B��N� ,%M� 8���|ixx� 8�&|��`�8�&� 9)&B��N� �@@�\|*�@A�P/�M� 9%��8���y) |�*9)&|�*})�9 `|H�|I�9)��B��N� ```/�M� 8���|ixx� 8�&|��`�8�&� 9)&B��N� |��&�!��|`x�b��������|x�������&��!��A�8��H&       `8!p�&|�N� &�|���������|~x�&�����!�q����Hm`��x|ex��xK���`肀�8�|~x�K���`8!����&�����������|�N� &�|ix9`8`�       /�M� ``�     &9k&}k�/�@���yc N� |���������|�+x|~x�&����|�#x8�&@�!�1;�p��xH�`��x|}x�~{� K���`8!&���x�&�����������|�N� &�|��"������|�#x�&����8��|�+x��������T>|x�!�a+�
�I�)8�!p�AxA�X� @@�|�"��     /�A���c8-�8�c9k&�c� ��8&�=p�+�?9)&�?8!�|x�&����������|�����N� ``�+������x��PK��!���?8!�8&|x�}p�i�&�?������|�9)&�����?����N� ``�cK��T&�```|��a������}Cx|�;x�&����|�3x��������|~x|�+x�!�a|�#x8�
1.1.1.2   root       42: 8�HQ`/�9 8&|c�A� `��9)&/�})�@���y  |�|��@�@|P|�/�@�0x �>|  �```���>9)&�>B��8!�8`�&�a��������|���������N� &�``|����p���x9�x9�0�&�&��:&��������:� �����&��|�#x|xx�!���A��; �a�������!���A���a�������������������!��;a&P;Ap:���{1�%/�A�8|P��@�,/�%A���#8�&�a&�8c&�a&��%/�@���8��a&�8!&P|xP�&���p|c����x�&��|��!���A���a�����������������&���!���A���a����������������N� `K�x|�+x8%�;�&|�P|
1.1.1.3 ! root       43: ��/�dA��/�iA��/�uA��/�xA��/�XA��/�pA��/�cA��/�sA��/�%A�/�OA��/�o9k&@���9 o9j&}AR}k�}aZ�*p�+p�/�%@� 9#&��!&�8�&�a&�K���`�&q��:&/�0A�/�.:` ;�qA��</�A�P|�:��&�;�8        ��T>+�)@�D8 ��T>+�       A�}z�;�&{� �+�<&/�@���~&�xK��p```�b��x�|�}`Z}i�N� X������������������������������������������������������������������������&������������������������X��������X&h������������������������8�8�
1.1.1.2   root       44: ~��x�?H=`x ��xK��}`�@@�D|c�Pxc!A�8/��!&�|i�A��A��```���!&�9)&�!&�B��;�H(`�!&�|��;�&{� �  �!&�8 &�&&���xK���`��@A���K��l``}:�~��x��x8�8� 9�)c�xK����!&�c�x��x8����!&�8     &�&&���&�!&�8 &�&&�K��]�<&K��}:�c�x~��x8�&8�
1.1.1.3 ! root       45: 8� �)9K����!&����a&��<&8c&�a&�K���}:��b��z�$8�~g�x}k9�)~��xc�x�KҐ8~E�xK��-c�x~D�x8�K��͍<&K��x}:��b��z�$8�~g�x}k9�)~��xc�x�KҐ8~E�xK���c�x~D�x8�K��}�<&K��(�<&:�/�h@���<&:�&K��`V�88      ��}:�~6��x�)�9A�4�a&��"��z�$})8-��I�!&��a�8 &}r�8�&&�~E�x8�
1.1       root       46: ~g�x9~��xc�xK��9c�x~D�x8�
1.1.1.2   root       47: K��ٍ<&K���```�<&:�/�l@��hK��````:`0;�rK���`9 dK���``9 iK��|``9 uK��l9 xK��d9 XK��\9 pK��T9 cK��L9 sK��D9 OK��<8&|  �K�� &�,$|ixA�&@+�$�$@�H&`9)&�$�i/� /   ,�
1.1       root       48: A���/�
A���A���A���/�@��/�0A��8�
                     49: /�A��8``8��9K��T>UJ>+�    +
1.1.1.2   root       50: 9)&9K��|4@�$8��T>+�}@4@�M� 9k��}`4�(L� �$|c)҉i/�|`@���N� `/�@��|/�08�@��p�        &9I&/�x@��h9*&�$�j&K��P```8`N� �     &9I&/�x@��(9*&�$�j&K���8���K���&�P&&�PPERROR: Flatten device tree available! Press "s" to enter Open Firmware.
1.1       root       51: 
                     52: bootinfo  !!! roomfs lookup(bootinfo) = %d
                     53: xvectCannot find romfs file %s
1.1.1.2   root       54: ofw_mainERROR: Not enough memory for Open Firmware%s%s[?25h
1.1       root       55:  exception %llx 
                     56: SRR0 = %08llx%08llx  SRR1 = %08llx%08llx 
                     57: SPRG2 = %08llx%08llx  SPRG3 = %08llx%08llx 
1.1.1.2   root       58: 
                     59: ELF relocation out of bounds!
                     60: ERROR: Unhandled relocation (A) type %i
                     61: 
1.1.1.3 ! root       62: 0123456789ABCDEF������������������������������������@�&C�I�&C�J@&C�Jp&C�L�&C�M�&C�N&C�O&C�R�&C�SP&C�T`&C�V&C�V�&C�XP&C�X�&C�\�&C�^P&C�^�&C�^�&C�_�&C�_�&C�`�&C�`�&C�aP&C�b�&C�c�&C�j0&C�&C�����k���ll@lPlxl�l�l�n@l�l�l�Ðl�mm(m@mXmxZ�m�k�k�m�m���f8��������?0?(xvect�`/�|i�8&N� |C�|    �|C�|�|C��/�|     �8N� |C�|     �|C�|�|C��/�|     �8�N� |C�|     �|C�|�|C��/�|     �8N� |C�|     �|C�|�|C��/�|     �8�N� |C�|     �|C�|�|C��/�|     �8N� |C�|     �|C�|�|C��/�|     �8�N� |C�|     �|C�|�|C��/�|     �8N� |C�|     �|C�|�|C��/�|     �8N� |C�|     �|C�|�|C��/�|     �8N� |C�|     �|C�|�|C��/�|     �8N� |C�|     �|C�|�|C��/�|     �8    N� |C�|  �|C�|�|C��/�|     �8
        !            63: N� |C�| �|C�|�|C��/�|     �8N� |C�|     �|C�|�|C��/�|     �8N� |C�|     �|C�|�|C��/�|     �8
N� |C�|     �|C�|�|C��/�|     �8N� |C�|     �|C�|�|C��/�|     �8N� |C�|     �|C�|�|C��/�|     �8N� |C�|     �|C�|�|C��/�|     �8N� |C�|     �|C�|�|C��/�|     �8N� |C�|     �|C�|�|C��/�|     �8N� |C�|     �|C�|�|C��/�|     �8N� |C�|     �|C�|�|C��/�|     �8N� |C�|     �|C�|�|C��/�|     �8N� |C�|     �|C�|�|C��/�|     �8N� |C�|     �|C�|�|C��/�|     �8N� |C�|     �|C�|�|C��/�|     �8N� |C�|     �|C�|�|C��/�|     �8N� |C�|     �|C�|�|C��/�|     �8N� |C�|     �|C�|�|C��/�|     �8N� |C�|     �|C�|�|C��/�|     �8N� |C�|     �|C�|�|C��/�|     �8N� |C�|     �|C�|�|C��/�|     �8N� |C�|     �|C�|�|C��/�|     �8 N� |C�|     �|C�|�|C��/�|     �8!N� |C�|     �|C�|�|C��/�|     �8"N� |C�|     �|C�|�|C��/�|     �8#N� |C�|     �|C�|�|C��/�|     �8$N� |C�|     �|C�|�|C��/�|     �8%N� |C�|     �|C�|�|C��/�|     �8&N� |C�|     �|C�|�|C��/�|     �8'N� |C�|     �|C�|�|C��/�|     �8(N� |C�|     �|C�|�|C��/�|     �8)N� |C�|     �|C�|�|C��/�|     �8*N� |C�|     �|C�|�|C��/�|     �8+N� |C�|     �|C�|�|C��/�|     �8,N� |C�|     �|C�|�|C��/�|     �8-N� |C�|     �|C�|�|C��/�|     �8.N� |C�|     �|C�|�|C��/�|     �8/N� 6�����������p0ofw_mainELF&&&@�X@8&@&&&&����?��c���?��c����?�c�a��?�c�0��|�|�<``c�c�`/�H&p|1C�B�|(��!���A�a�� ��(��0��8�&@�!H�AP�aX��`��h��p��x�&��!��A��a��������������&��!��A��a�������������8`|x|B��&|B��&,        @�|��<�|�|&�&&|&��&&|B��&&|B��&&|��&& |��&&(|��&&0|��&&8B�
���|H��"|!8�&���!�&<@��0|��B�8L$|�B����}�|��}B��(|&x��H|x��h|x� �� |x�(��(|x�0��0|x�8��8|x�h��h|
x�p��p|x�x��x|x����|x���(�|x���H�|x���h�|x�����|x�����|x�����|x�����|x����|x���(�|x���H�|x���h�|x�����|x�����|x�����|x�����|x�&} &|� �(&�&(} �|&d|�L&,�(&(N� |��K��u|��8`N� |��|i�K��]N�!K��U|��8`��N� ``|�8�Tc0T�0|� PT���|��|l|�|�|�L&,8c�B��N� ``|������&|�3x��|      �N�!�������&|�N� &&`|��"�����|wx�&���p���x�&���!���A���a���������������&���!���A���a�������������������!��� /�@�<�B���(}+Kx9
1.1       root       64: 8�
                     65: 0�  ���B� ����*8&�       �iz���A��B��j8�
                     66: ��z��A��B��j8�
1.1.1.3 ! root       67: ��z���@�|z���A�*X�B� �b�9);���j8�
1.1.1.2   root       68: �+��:s&�:�p:�u;&v;`:&;���:�x��;A�;�&: ;!�>@&```}��N� z���8`A��"��i8���k�    8!P�&���p���x�&��|��!���A���a�����������������&���!���A���a����������������N� �b���       ��0�+��9I�K�   }��N� �b���       ��8�+��9I�K�   }��N� �b���       ��@�+��9I�K�   }��N� �b���       ��H�+��9I�K�   }��N� �b���       ��P�+��9I�K�   }��N� �b���       ��X�+��9I�K�   }��N� �b���       ��`�+��9I�K�   }��N� �b��B�h��   �+�
                     69: ��9I�K�        }��N� �b��B�h��   �+�
                     70: ��9I�K�        }��N� �b��B�p��   �+�
1.1       root       71: ��9I�K�        }��N� �b��B�x��   �+�
1.1.1.2   root       72: ��9I�K�        }��N� �b��B����   �+�
                     73: ��9I�K�        }��N� �b��B����   �+�
1.1       root       74: ��9I�K�        }��N� �b� �+8     ���;�����}��N� �B� �b�8�*9 �
1.1.1.2   root       75: ���+��9I�K�        ����}��N� ����}��N� ����}��N� �b���+9I�K� ��   ��}��N� �b���+9I�K�       ��   ��}��N� �"���)�i|�       ��   ��}��N� �b�;��+8       �����   ��}��N� �b�;��+8       �����   ��}��N� �9>});�����}��N� ���9>�o�K/�@�})9k��;��o����}��N� �b� �+8       ���~~�x����}��N� �B��9>;��j9�
1.1       root       76: �����}��N� �B��9>;��j9�
1.1.1.2   root       77: �����}��N� �b���  �+��9I�   �K� }��N� �b���       �+��9I�   ���K� }��N� �"���       �)���       |�x$|     *�     }��N� �"���       �       ��0���     }��N� �"���       �)���i���   �     ���i}��N� �"��B� ��       �       �j��8��8������ }��N� �"� �B���   �       �j��8��8������ }��N� �"� �b���   �       �+��9I��K� }��N� �b���       �B���+��8   }JP�}Jt�I}��N� �"���       �b���I���
                     78: 0��x$|�        }��N� �"� �b������       �I�+��|PP9I|t0&�K�       }��N� �"���       �B� ����i��8������0��x$|�
1.1       root       79: }��N� �"��b� ��  �)�k���   x$|�|*� }��N� �"���       �i���K���|
                     80: ����        0��� }��N� �"���       �i���K���|PP����       0��� }��N� �"���       �i���K���|
                     81: &�����        0��� }��N� �"���       �i���K���}@6����       0��� }��N� �"���       �i���K���}@6����       0��� }��N� �"���       �i���K���}@4����       0��� }��N� �"���       �i���K���}@8����       0��� }��N� �"���       �i���K���}@x����       0��� }��N� �"���       �i���K���}@x����       0��� }��N� �"���       �)���i��       }��N� �b���       �+��9       ���I� ����
                     82: }��N� �"���      �)���i��       }��N� �b���       �+��9       ���I� ����
                     83: }��N� �"���      �)���i��       }��N� �b���       �+��9       ���I� ����
                     84: }��N� �"���      �)���i��       }��N� �b���       �+��9       ���I� ����
                     85: }��N� �"���      �)���i��       }��N� �b���       �+��9       ���I� ����
1.1.1.2   root       86: }��N� �"���      �)���i���&�&�&p�       }��N� �B���       �j��}i[x�k�       ���&p9)��x��*��&�&}��N� �"���   �i���+9I&�       �&t� &��
1.1       root       87: &��
                     88: �&�&t�}��N� �B���  �*��}+Kx�)����&t9k��TF>�j�   9i&��     &��&�&�}��N� �"���       �i���K����|&T��|�|�����       0��� }��N� �"���       �i���K���|P|&����   0��� }��N� �"���       �)���       |�v� }��N� �"���       �i���K���}@x0��|&����       0��� }��N� �"���       �)���       0��|&�     }��N� ���B� ��   �h����9'����8�8�����k�i�}��N� �b�9>�K8���8����
                     89: ���
1.1.1.3 ! root       90: ���@�~A���B� �j8�������;���}��N� �"� �;��i�K9J&�K�i��K���PA�!����;���}��N� ���"� ��;��H�i8�����J��/��}HR�KA�!p�I}KSx�J���}@PP9��|@P�P@@�`9k���i��;���}��N� �b� �9>});��0�������}��N� �"��;��i9K���k�I/�A��"� ��        0��� ��;���}��N� �b� �+8 ���)�;�����}��N� �b� �+8 ���)�;�����}��N� �"��i8����� ��}��N� ����   �h��9K��8����+�H8���k�����J���}@[x|Kxx`/�A��/�A�</�@��P@A�|�J|�J�8@9A�H�|@*9)��|A*/�9��@���K��h�B��*9i��8����   �j8���yE�|Cxx��|�x�)�����k����}*[xyJ`/�A��/�A��/�A�D/�}+J}+HP})�@�`�9k&B����       ��}��N� ���O9j��9���
        !            91: �o9(��/��J����k���/@�T����@@A��A��4���}�@�,H�```��&|�B|�P��8@A��A��4��@���8    ��i��   ��}��N� ���h9K��8����+�H8����k����}`Kx�J����|Sxx`/�A��/�A�d/�@���P@A�|�J|�J�8@9A�H|@*9)��|A*/�9��@����� ��}��N� ����     �O�9j��9+���
        !            92: �o8����J���/�A��������@�I��A��i��|x}��N� �b���      ����+��9I�K�   }��N� ����       �/�8       �����/��)��A�����8�ix��&��!��a�Ho]`���&��!�4����a�|x9)&���|rx@����B���/xh|
        !            93: �    }n[x}��N� �"���   �i��9K��8
        !            94: ���k�I����        H0�`}��N� �"���       �����oH0�`�o}��N� �"��� �����oH0�`�o}��N� �"��� 8`��i��9���8����������       ����H/�`�o��}��N� �"���       8`&�i��8�����   H/�`}��N� �"���       ����8����       �o��H09`�o��}��N� ����       �/���iHj�`�/8       ��i}��N� ��   �b��8�8�`����HlQ`}��N� ����     �o��9+����//�A�����       ��9)���/}��N� �"���       8` �i��9���8����������       ����H.�`�o��}��N� �"���       �i��8���k�       H<�`}��N� �"���       �i��9���8���������   �o��H9)`�o��}��N� �"���       �i��8���k�       |c4H �`}��N� �"���   �I��9j��9����i8�������       �k��� H �`}��N� �"���       �i��9K��8
        !            95: ����I�k���        H �`}��N� �"���       �I��9j��9����i8�������       �k��� H �`}��N� �"���       �i��9K��8
        !            96: �����I�k���        H �`}��N� �"���       ����8�����       �o��H M`1��||����}��N� ��       ��H m`}��N� ����     ~��x�€�袀��/���iH!`�/�&x�       �/8 ��i}��N� ����       ~��x�‰�€��/��8   �����i��H!�`�/�&x� �/8 ��i}��N� �"���       �����oHL�`�o}��N� �"��� �����oHM`�o}��N� �"��� �����oHM-`�o}��N� �"��� �����oHMU`�o}��N� ���� �/�������iHLi`�0���}��N� �"���     8`�i��9K��8
        !            97: ����I����        H,!`}��N� �"���       �����oH,`�o}��N� �"��� ����8����       �o��H,)`�o��}��N� �"���       �i��9���8���������   �o��H/9`�o��}��N� �"���       �i��8���k�       H4�`}��N� �"���       �i��8���k�       H4
`}��N� �"���       �I��9j��9����j�i8������������       ���H0�`�o��}��N� �"���       �I��9j��9������i8�����������       �o��H7�`0c��|c�o��}��N� �"���       8`�i��9K��8
        !            98: ����I�����        H*Q`}��N� �"���       8`�����H*`�o}��N� �"���     8`�i��9K��8
        !            99: ����I�����        H)�`}��N� �"���       8`�����H)�`�o}��N� �"���     8`&�i��9K��8
        !           100: ����I�����        H)�`}��N� �"���       8`�����H)5`�o}��N� �"���     8`&�����H)     `�o}��N� ���� �/�������iHIQ`�0���}��N� ����     �/�������iHIm`�0���}��N� ����     �/������iHI�`�0���}��N� ����     C�x8��/����HOQ`�z�9+&+�&@���/�   �/8 ��i�/8 ��i}��N� ����       ��x�/�9I��9j�����Oy� ����o�&�Hd1` ��8�x� |}rHc�`8���C�xx� ��xHN�`�z�Z�&�9+&+�&@���/|x8   ��I�/8 ��i�/8 ��i}��N� ����       8���x|��8����9H��9j�����O8���8������o�J��������H }}HP|P��   8�&9)&|��B@��8A����)K�������       �o��9+��9I���k�/8
        !           101: ������O����HO�`�//�8    �@����}��N� ��       ��HU�`}��N� �� ��HI)`}��N� �� ��HJ�`}��N� �� ����x���/���9i��8�����oy� ����HbM` ��8�x� |}rHa�`�/��x9i��8����o�i���HWm`|`yA�
��/9i�o�   �/�!�8     �H`
`�!�����i�/8 ���}��N� ����       #�x�/��9I��9j���   �Ox ����o�&�Ha}`�&�8� ��|yx� Ha!`�/��x9I��9j���     �Ox ����o�&�Ha1`�&�8� ��|}x� H`�`�/��x&�x9i��8����o�i���HX`,#A�<�/8     ���}��N� ����       #�x�/�9I��9j�����Oy� ����o�&�H`�` ��8�x� |yrH`5`�/%�x9I��9j����O�i���oH\�`�&�,#A���/|x8       ���}��N� ����       �/��9i��8����o�i���HGe`,#A�0�/8   ���}��N� ����       ��x�/��9I��9j���   �Ox ����o�&�H_�`�&�8� ��|}x� H_=`�/#�x9I��9j���     �Ox ����o�&�H_M`�&�8� ��|yx� H^�`�/%�x��x9i��8����o�i���HX�`,#A�
        !           102: (�/8 ���}��N� ����       �/��9i��8����o�i���HN%`,#A�
        !           103: `�/8 ���}��N� �b���       �+��8       ��i}��N� �b���       �+��8       �|���     }��N� �"���       �)���       |�|��L&,�b�9)���+}��N� �b���       �+��8       �|���     }��N� �"���       �)���       |���b�9)���+}��N� �b���       �+��8       �|���     }��N� �"���       �)���       |&d�b�9)���+}��N� �b���       �+��8       �|��     }��N� �"���       �)���       |��b�9)���+}��N� �b���       �+��8       ��i}��N� �"���       �i���|�|��|��|��|��|��|��|��9k���i}��N� �b���     �+��8       �|���     }��N� �"���       �)���       |��|��L&,�b�9)���+}��N� �b���       �+��8       ��i}��N� �b���       �+��8       ��i}��N� �b���       �+��8       ��I}��N� �b���       �+��8       �|��     }��N� �b���       �+��8       �|B��     }��N� �b���       �+��8       �|���     }��N� �b���       �+��8       �|B��     }��N� �b���       �+��8       �|
B��     }��N� �"���       �)���       |���b�9)���+}��N� �b���       �+��8       �|���     }��N� �"���       �)���       |K��b�9)���+}��N� �b���       �+��8       �|J��     }��N� �"���       �i���|C�9k���i}��N� �b��� �+��8       �|B��     }��N� �"���       �i���|C�9k���i}��N� �b��� �+��8       �|B��     }��N� �"���       �i���|C�9k���i}��N� �b��� �+��8       �|B��     }��N� �"���       �i���|C�9k���i}��N� �b��� �+��8       �|B��     }��N� �"���       �i���|K�9k���i}��N� �b��� �+��8       �|J��     }��N� �"���       �i���|K�9k���i}��N� �b��� �+��8       �|J��     }��N� �"���       �)���       |�|æL&,�b�9)���+}��N� �b���       �+��8       �|�|¦� }��N� �"���       �)���       |l|�|�|�L&,�b�9)���+}��N� �"���       �����oK��Y`�o}��N� H�"���     8��i��9���8��������o���       K�Ս�o��}��N� �"���       �I��9j��9���8�����������o���   K��M�o��}��N� �B���       �*��9       ��8���i�
1.1       root      104: �)���
1.1.1.3 ! root      105: }kJ9kU)0Uk0}iXPUk��}i�|Hl|�|O�|�L&,9)�B��}��N� �"���      �i���|�9k���i}��N� �b��� �+��8       �|��     }��N� �b�;�&K���|��|��C�x��xHG�`��z/�@���/8     ���}��N� 9I��x�/���y*��|Cx9J&}h[x@�9@&H�95J��9)��@���9I��}h[x/���y*��9J&@�9@&H�95J��9)��@���9I��y)�B/���9)&@�H&��9k5)��@���K��L})ZK��l�/9I�O�i�/9i�o�     �/8 ��i}��N� �P@A�8}
        !           106: J�@@@�,}kJ9)&})�9 H|H�|I�9)��B��K��9)&|
        !           107: �})�B@��}*�
1.1.1.2   root      108: 9J&}        Y�K����P@A��}
1.1.1.3 ! root      109: J�@@@��}kJ9)&})�9 H|H�|I�9)��B��K��T�/8        ��i}��N� �/8 ��i}��N� �/8 ��i}��N� �/|x8     ��i}��N� 9)&})�9 B@��|     �9)��}
        !           110: �}&�K����/8        ��i}��N� �i}��N� �:K��9 &K��`�/���9i�o� }��N� �/|x8     ���}��N� �/��}��N� |     x���K������9 H`}i�9)��|jX��&��!��A��a�HT�`�a���|hx|dX��&�HT�`�&��&��!��A��@@�@9���/�@���|x}��N� 9H|P*9)��|Y*9/�@���K����/|x�i}��N� �P@A�|�J|�J�8@9A�49H|P.9)��|Y.9/�@���K��|@.9)��|A./�9��@���K���P@A�|�J|�J�8@9A�49H|R.9)��|[.9/�@���K��H|B.9)��|C./�9��@���K��,8&K��x8 �����   ��}��N� 8   �� ��   ��}��N� 9H|
        !           111: @*9)��|A*9/�@���K��t�P@A�|�J|�J�8@9A�49H|
        !           112: @.9)��|A.9/�@���K��4|@.9)��|A./�9��@���K���P@A�|�J|�J�8@9A�49H|
        !           113: B.9)��|C.9/�@���K���|B.9)��|C./�9��@���K�м�i|
        !           114: x�K�ޔ9k���iK��,&�|�/��&�!��A�xc H!`8!p�&|�N� &�`|�8c����������|�+x+�&�&�����!�q@�,8!�8`�&�����������|�N� ``/�@���|�#x;�H,```;�&H�`;�&����@�H�/�
1.1       root      115: @���8`
;�&HY`���;�&HE`��A���```8!���x�&�����������|�N� &�`|��&�!��H&�`8!p�&|�N� &�}��|�#x8�|#8A�H�}B�,A�4Hx��}B�8�|'0A�8��|' 8`&A�P|�#x|qB���8�|' A�|����������|���(8� �� 8`~�x}��N� }��|�+x|�+xH9,&@�}��N� |��:��8����E&�P&B��~%�x}��N� }(�|�#x|jx|�#x8� |�+xHE,&@� �,|�*@���8`&}(�N� 8`�����|�B}(�N� 9J��9k���        ��     |-p9�&A�N� q��@���9�N� �!��|��&0��8��@��H|�+xK��Y�&0|����������H��@��88!PN� N� xf��8`X8�8�&D"N� |jx8`T8�D"|�#yA�x�F �jN� }�|ix�i,A�K���9)&K���}�N� }�|ixy#' pc,
                    116: A�8c8c0K��}y#F pc,
                    117: A�8c8c0K��ay#e pc,
                    118: A�8c8c0K��Ey#� pc,
                    119: A�8c8c0K��)y#� pc,
                    120: A�8c8c0K��
y#� pc,
                    121: A�8c8c0K���y#� pc,
                    122: A�8c8c0K���y#"pc,
                    123: A�8c8c0K���y#'pc,
                    124: A�8c8c0K���y#Fpc,
                    125: A�8c8c0K���y#epc,
                    126: A�8c8c0K��ey#�pc,
                    127: A�8c8c0K��Iy#�pc,
                    128: A�8c8c0K��-y#�pc,
                    129: A�8c8c0K��y#�pc,
                    130: A�8c8c0K���y#pc,
                    131: A�8c8c0K���}�N� }�|ixK��}�|ixK��t}�|ixK���|��H|��|��8��xxg�j|�8�|8N� }h�|ix8`CK���}#KxK��18`K���8`K���8`K���8`K���8`K���}h�N� }h�|ix|�#x|�+x8`
                    132: K���8`
K���}�cxK���}#KxK���8` K���}CSxK���8`
1.1.1.3 ! root      133: K��y8`
K��q}h�N� 8�EK���}h�K��1}h�8�W@���N� }h�8� K��}h�8�D@��tN� }h�|�#[email protected]���8`A�8`&}h�N� |��H|��8��Tpc|�2��|��N� N� `|��&�!���cm`E/�LFA�8!p8`���&|�N� �/�@���c8��T>+�&A��Сc8��T>+�&A����/�&A�$/�@���HI`8!p�&|�N� H�`8!p�&|�N� &�```|�=`E��������|�#x�&�!��akLF;�����XA�$8!���x�&��������|�N� `�;���/�@��Ԡ;���0��T>+�&A����;���0��T>+�&A�����/�&A�8/�@���8�H�`8!��~��x�&��������|�N� 8�H]`8!��~��x�&��������|�N� &�``|�= E�A���a��|�3x�&����a)LF|�#x��������|�;x|�+x�����!�a|x;�����HA�48!���x�&�A���a�����|������������N� `�;���/�@��Ġ;���0��T>+�&A����;���0��T>+�&A�����/�&A�t/�@���H`E�xf�x��P��x��xH1`��x���x��Hi`8!���x�&�A���a�����|������������N� He`E�xf�x��P��x��xH�`8!�����x�&�A�����a��|���������������N� &����,}C|./�&A�L�*9`}*BH ``�      }*Kx})B/�&A� 9k&}k��8@���8`N� `�jN� ```|�}�&�&����.%-������&��|�3x�A���a��|�#x;`��������|�+x|}x�����!��;����!�A����H,```�,;�&�����*A����/�&@���/�A�&�?9��A�0��A(#�x|     ����|�\N�!�A(/�@�����|��#�xHE)`��?8�|y|HPx HDy`��/�A��XA��T��A(#�x;�&��| ��w�WN�!�A(�,���*@��4``8!��`��&��{c �����&��|��!���A��}�& �a�����}�� �����������N� `�?�{�P{�K���� � ��8}C|./�&A�L�69`}*BH ``�     }*Kx})B/�&A� 9k&}k��8@���8`N� `�jN� ```|��!���A���&�a��|�#x��������;���������|x�!�Q�#(#�>�xH(```;�&�<;�@����A��/�@����>,�^(y)6d}9J{Z6dY��     x     ��A���� /�A����_ ��8;��z��8|�2|�2|P.}_R/�&�A��``�69`}*BH� }*Kx})B/�&A��9k&}k��8@���|0*x�"y+.�y)$})XP�ex� |i+�@|�#}+J}`�})�@���b��HC�`� �8����`@��x@����_ ���z��8|�2|�2|P.}_R/�&�@��@```|0*�*�@@��\�b��HC]`� K���```�B��x�d|
        !           134: �}@R}I�N� ���X&���X���X&&d&P���X���X���X���h���h���X���X���X���X���X���X���X���X���X���X���X���X���X���X���X���X���X���X���X���X���X���X���X���X���X���X&D&8���X&,���X���X���h���X���X���h���h���h���h&���X���X���X���X���X&���h���h���X���X���X���h���hU):�+K��\�+K��T�|��� K��@y)� �+K��4y)"�+K��(�+� K��y �y)��|        �K��y)��+K���``8!��&�!���A���a��|���������������N� &�``|�}�&�&����.%-������&��|�3x�A���a��|�#x;`��������|�+x|}x�����!��;����!�A�� ��H,```�8;�&�����6A����/�&@���/�A�&�?9��A�0��A(#�x|     ��(�|�\N�!�A(/�@�����$|��#�xH?)`� �?(8�|y|HPx H>y`�(/�A��XA��T��A(#�x;�&��| ��w�WN�!�A(�8���6@��4``8!��}|{�&�������&��|��!���A��}�& �a�����}�� �����������N� ``�?�{�PK����     `|�����8�|�#x�&�!��|dx8`K��&`��x8�8`K���`�����xH;�`��x|dx8`K���`8`8�8�K���`8!�|c��&����|�N� &�&D"N� xf��8`X8�&D"N� }H�H-}H�,M� = �a)���|dH�8�&��N� |dx8`��= �a)�����|0@L� 8`TD"= �a)���8`�i(M� 8`������N� ���|dx8`&D"N� 9`}*Kx} Cx|�;x|�3x|�+x|�#x|dx8`& D"N� |�#x|dx8`<D",#|�#xM� 8`��N� |�+x|�#x|dx8`@D"N� ``xi&�89)�x(xc$|     8c�x�xc�|`N� ``����|x8`�/�@�Tx� �8`@T��>T�@.|�x8�x� 8�D"|��8`<8�8�D"/�8`��xc A�����N� x� ����T�@.|c4T��>|c#xxc N� &`����|x8`�/�@�|x� �8`@T��>T�@.|�x8�x� 8�D"|��8`<8�8�D"/�@�Dx� x  x�U+�>U#@.|c[xT     D.T�>} xTc�|cxxce����N� ``�b������N� &``|���������|}x|�#x�&�����!�qK��!��x|x��xK��q8!�xc&��&���|��������|�N� &�```|���������|}x|�#x�&�����!�qK��q��x|x��xK��&8!�;��xcd�&����{����������|�N� &�`�/�L� �8�&8`@8�8�D"N� ```�/�L� x� �8`@T��>T�@.|�x8�x� 8�D"N� ```�/�L� �x� 8`@8�&8�D"N� ```�/�L� �x� 8`@8�8�D"N� ```�����|ix|�#x��������8`��/�@�0��/�;�A��A�,/�&A��8`��```�����������N� /�A��/�@���8`<8�|��D";���/�{��@�x��8�8`<|�*8�D"/�x� A�8���x� |��x�����������N� |�"8`<8�D"/�x� A��h8`��xc K��\``|�"8`<8�D"/�x� A��88`��xc K��,``|�"8`<8�&D"/�x� A��8`�K�������|�3x��������/�A�(;���x�����������N� ```/��@���9&��;�y) ��9)&|�#x�!��``8`<8�&��xD"/�x� A�8����;�&;�&�&��5 ���!��@�����x�����������N� `|���������|�3x|}x�&����8��|�#x��������|�+x8������&��8��!���A���a���!�1�&pK��}`8��|��@A�8��x8�K��
`8�xz ��xK���`8�|yx��xK��E`8�|xx��xK���`�"��|{x|wxT<}k����}KӖ}J��}jXP}k�9&9K}�Ӗ|�Ӗ�Ӗ}���|���_��}@Pyc&�y }GPPy�&�y_ |�}9*|�"{�&�}Y*9&�!*������ ;���;���;����P��xx�W�H,���9ap}y)*=`��i9 �&��
        !           135: |�8���x�88    &�K��M`�W��@@�<= �a)�H```A� }i�|��9i��/)�@A���&p��/�@�D8!��&���������&��|��!���A���a����������������N� ``��p�b��H5�`8!�8`�&���������&��|��!���A���a����������������N� `�b��H5�`8!�8`�&���������&��|��!���A���a����������������N� &�
        !           136: ```|�����8��|x�&�!��K��9`��xK���`8!��&����|�N� &�&`|�����8�&|x�&�!��K���`��x8�K���`��x8�K��      `��x8�K��I`88��8&���xK���`8!�8`�&����|�N� &�&```}�&|���������9`|�+x�&����8�||x�����a���"�������!���&���p88��&��&��a��&x9`&�&��&��a��&��)�!x;�x;�����K��Y`Tf>+�@�8�|����x8���xK���`��x���H�`|{yA�d�b�d�xH3Y`�����xH�`8!&pc�x�&���a�����|��������}�& ����}�� N� ```��x;�pH�`8�&|{y@��`��x8���xHE`/�|{xA�&T�!p8��   /�@���;����xH�`-�|{x@����x8�H
        !           137: �`.#|x@�&(��;�/�@�H�A�������@@�& |�(P|��x� ��x��xH�`/�|{x-�@����b�0d�xH2`HD```�b�d�xH1�`K���```�b� d�x;�H1�`�����xH`�����xH`@��l8!&p��c�x�&���a�����|��������}�& ����}�� N� �b�d�xH1i`K��```�b�(��x��xM�;�H1=`K��h;`-�K��\�``|�����8��|x�&�!��K��)`��xK���`�"��8!�8�����     �&|�N� &�&``|��"�������&����8��|}x��������|�#x|�+x�!�q��/�@����8�&K���`��x8�K���`��x8�K���`8���xK���`8&8�|ix��x� ��K��M`�b�8��x��x��xH�`88!�|x�&����������|�����N� &�``|����������&����|�;x�&���!��|yx�A���a����������|�3x��������|�#x8��!�1|�+xK���`8�x{ #�xK��]`8�|xx#�xK��   `8�|zx#�xK��e`8�&�||x|vxT       <})��}iۖ}k��}+HP}+�9+&yg&�|�ۖ�9*}@ۖ|���j��}&HP}X:y& x�&�}8B������9@�A*�I9@�I}[PyJ�}ZR�j�� |��:#�x8�8     &�K��a`�V��@@�H= �})�a)�| �`��| �H}i�B@$|��9i���P@A���/�8`��A�H��wx  x�U*D.U)�>}IKxT
        !           138: D.T�>}@xU)�} x|��@@�P�8`8!��&�����������|��&���!���A���a����������������N� ``}`[x8`�K���&�`�"�@�������iN� ```|�������@8�8� �&�!���H+A`�8�8� H+-`�"�H�8!������        �&|�N� &�&``|����������&�!��8����@�b�H�?�C�k�/�@�,8!&P|x�&��������|�N� ```/�@�,8!&P8��|x�&��������|�N� ``��/�A���+� 8��A���}dXP8��ye �P@A���x� |'x�TD.T�>}`x|��T��Gp�� �A(| ��i�IN�!�A(8��/�@��0�?�8���     �KU�>UG�>U@.UJ@.}3x}J;x}4}J4�P@���/�kA�(�)9)&} x|�|�p|�x�BxK���;�t8�8����xH)i`��T �>T@.|Kxx� +��@�8��8�   ��xH(�`�b�P��xH+`8��K��`&�``|���������|x�&�!����K���8�"�H����x�i9K�I9@|�K���ix
        !           139:  x�UGD.UJ�>|�SxTD.T�>|�xUJ�}@x99@&��    �K&K���,#@���"�@�)9i*�x x"x
        !           140:  yh UD.UGD.x�yk�U�>UJ�>|�Cx|�SxUfD.TD.Uk�>T�>|�x|�[xU�U@�}[x|;xyk�x }`x��        �8!��&��������|�N� &�|��a������|�3x�&����|�#x��������|�+x|x�!�a�K��-�<8 ���@@�|x�"�H{f"{h {� �i8� 8t�8�x� y TD.y�xƄT�>|�xUD.U�>UdD.T�D.Uk�>T��>{� |�3x|�[xT�UD.U�>|�Cx|�+x�iT���_xx� |��x8�y@ yJ�TD.T�>{��TD.T�>U_D.|�xcxU�UJ�>|+x�SxTc�x��|jSx|�3x�9&8���K�&�     ��xK���|yA�88!���x�&�a��������|���������N� ```�"�@��x      x�U?D.U)�>�KxT     D.T�>} xW���x��{� �(@@�;���K���`��x8�H&`K��l&�|���������|�#x�&����|x�!�q��K��=�"�H8s�_���x�i9K�I9@p�K��i�8�x
        !           141:  ��UHD.x���UJ�>}
        !           142: SxTD.T�>}xUJ�}@x9@&��K&�i8&�    K��),#@�<�"�@�)� x      x�U+D.U)�>}iKxTD.T�>}`xU)�} x�8!��&�����������|�N� &�```|���������|�3x�&����8��|vx��������|�+x|�#x�����&���!���A���a�����������!�1�/�A��K�����H{� {� U'D.U)�>{��{ބ�w|�KxW�D.W��>9K}�x�W9@nT��KT
        !           143: D.T�>}JxW�D.W��>|�xUJ�|�Cx}Jx8�&8�~��x~��x;`~��x�78�
����&�        �     �I�/�A�& `/�/@� ``�&/�/A���/�A�,��xH`A�0�&/�// @�����P��x{� �b�X��x��x}�xH!�`/�A����@�7�v9I�|PP|��X@A�&�;�&��W�:W� 6}J@P}J�8
        !           144:       �X@A�&�|�P��xx ��xT�>T@.|[x��P�       8     �|xH"�`�/�����A�&���x��x�/�@���}�x/�A�&|{` ��@}�xT     @.})4T�>} xx ��~óx�8� K��M|`y@���x~��x�T�>T@.|[xyk ��A�&9k��}k�/���A�h```� /�/@�`� &/�/A���/�}5Kx@�H`A��&/�// @���9k��~��x}k�/���@������     |�x�8!�|x�&����������|������&���!���A���a����������������N� ��x��x;�K���`��P��x{� K�����;���/�/A�����x}�xK����4K��l8K���~��xHa`8��/�@��X��@8K���&�`|�����|�#x�&�!�q�apK��I�"�H{� {��T
        !           145: D.T�>}@xW�D.W��>�iT�}_�x9|�x�        9x8���i�ap8!�8�     8&�&���&����|�K��@&�&|���������|x�&�A���a�����������!�a�cHe`|~x�HU`���;��@@�<8!�8`���&�A���a�����|������������N� ```K��1�H;����>8     �8h�     8� ���x  x�U+D.U)�>}iKxTD.��T�>}`xU)�} x9 &��<&8�H�`�~xc ;{T`�>Tc@.|cx�~�|���xH]`��x|exc�xH`��^H9`||x�|��H!`�~xc ;{T`�>Tc@.|cx�~|z�.���xH�`��x|exc�xH�`��H�`8!�}<�.��x8 �A���a����&������|���������K��,&�```|���������|}x�&���������!�qK����H�`��x�?8 �8d�     8� ��9|x  x�U*D.U)�>}IKxT
        !           146: D.�T�>}@xU)�} x9 ���<&�H�`�?xc T`�>Tc@.|cx�|;���x��H�`��x|ex��xHq`��x��H�`|��x�K��|yA�48!���x�&����������|�����N� ```�"�@�}��$y  y)�T
        !           147: D.T�>}@xU*D.U)�>}IKxT�|Kx�X@@�}`[x��8�
�b�hTD.T�>|�xx� H-`/�@��`;���K��X&�``+���8A��"�p|        �|xN� ``+���M� �"�p|��N� +���8A��"�p| .|xN� ``+���M� �"�p|�.N� +���8A��"�p| .|xN� ``+���M� �"�p|�.N� +���8A��"�p| *|xN� ``+���M� �"�p|�*N� <&�@�8`N� ```�b�p<c&�/�@���8���8cN� �"�p8=)&�     N� ��p8�8``���<�&}Cx``x` }(�/�M� 9#&8�y) �(A�|�H�8�}h�8x� |     �|�;x+���9I&8A�|H�}`ZyI yk B��U`�>}`ZUk>�XL� +���M� |:./�M� T 6|`|c�� @��dN� ||��L� 9#&9`�}#Py) })�A�<= ��HA�0``x` 8c&+���A��"�p}i&�|c�B��N� 8&| �K���`<&�B�p9 |     �9````y  9)&})�}j&�B��N� ```8c��8�/�|��|i�A�8�|�J|��� @�Xxc 9@8&|c Pxc � |i�A�@<��A�4``y  9)&+���A��b�p}K&�})�B��8`N� 8&| �K���|`y8`M� | �|�J|��� @�Tx 9@8&}k Pyk � }i�A�<<��A�0`y  9)&+���A��b�p}K&�})�B��8`&N� 8&| �K���N� |��!���A��|zx�&�a��8|�+x��������T6|�#x�����&��|������!�Q|�3xK���|yxK���<&|P��A�&�{8 +���@�&4;�{� +���@�&;�;�{� H$9=&8&}{�A��B�p}j�y= x c�xHm`+����@A���9&+���y 9 @��8|     �```+���9~&8A��B�p|
        !           148: �} Jy~ y) B��+���@��8!�;9��9��:C�x�&�&���!���A��|��a����������������N� ```�"�p})��K��d`�"�p�&p�&���.K���```�"�p���;�{� +���A���K���`�b�pU �>} J}+A�K��P```8!�8��C�x�A���&�&���!��|��a����������������N� &�`|��&�!��K���8�袁x8�`���|�0P8ap|��K����ap8!�0��|`�&|�N� &�``}�&|���������.$|�+x�&���!��; |xx�A���a��|�#xc9����������?`&-%��������;�-����&���!�A��p?�:�;�8&8�x ��A�|��{� 98y |        �}8�} Cx``+���9I&8A�|H�}`ZyI yk B��U`�>}`ZUk>�X@��+���;�A��B.A��/�A�t@�|A��|�P9>| �y) ��x+���9I&8A�|H��yI 9k&B����x~�x8�H�`/�A�4W� 6������@��89 ��H(|8���@���K��|9=��8U) 6|�})�8!���8�x�&���&������|������!��}�& �A���a��}�& ������}�� ��������N� �
        !           149: ```|�� ��������|}x�����&|�#x|�+x�!�a@�(8!�8`�&�����������|�N� `8�8ap8�K����&x�p/���A���}>�P�A���{� {� 9d��}>�}k�})��HA��|� P9x� |��`y` 9k&+���A��B�p}
        !           150: &�}k�B��{� �8P|J|��@�L9i&9@�}iPyk }i�A�&�=`��XA�&�y  9)&+���A��b�p}K&�})�B��;���{� +���A��"�p��.K��I8!�8`&�&�����������|�N� `|iXP<&|c��A���袁p=�&�/�@���8    &9L�X|     XPx }HSx|     �}'KxA��<��A��``x� 8�&+���|��8A�|0��9&B��|� P9x� |��``y` 9k&+���A�}&�}k�B��{� }g�yk |cZ}k�|c��@�<|kPxc |i�``y` 9k&�
1.1       root      151: +���}k�A�}&�9J&B��8�K��H8&|    �K��88&|     �K��l&�```|��&�!��8&+�&8@�&px� `��}$y) }+��A�h}jX�}$HP=J&9)��8
1.1.1.3 ! root      152: &y) x |    �``y` 9k&+��9I&+���}k�9A���p}�A���p}I�yI B��89 `��a)��|�P|���H@�H89d&`���H|P9`x |     �A��x� 8�&+���A��"�p}i&�|��B��8ap8�8�K��%�ap�!|9k��8     }i�|J|��@�Pyk 9K&}kP�yk }i�9@A�X=`��XA�Ly  9)&+���A��b�p}K&�})�B��K��Q8&8!�|x�&|�N� 8&|     �K��<8&|     �K���&�|��a������|�#x|�+x�&����8�8���������|x|�3x�!�Q;�p��xK��1�!x�ap8 &+�&@�<9+��9@})�}iXPyk }i�y  9)&+���A��b�p}K&�})�B����xd�x��x��xK��A�&x�p�A�;�;�K��U8!�������x�����&�a�����|��������N� &�`|��������������&�!�q��&���&�|dx��&���&��&&��!&��A&�;�p8�&���xH�`/�|}x@�0��x`�~8�;�&8�&K��Q`|�P��A���8!&���x�&�����������|�N� &�|��A���a��9 9`�&����<&��������|     ������!�A��p��x`y  9)&})�}&�B��;�p;�����?�ib��x�&tc�m,8�Q��x8��pK����a������x��x8�Q8��p�&t{{ K���!�+���A�8@|�.8x +���A�9`}.8x +���A�9`&}&.y) +���A�8@|K.8     x +���A�9`}.8 x +���A�9 &}?&.�b��K��袁���x8�p8��K���K��8!��&�A���a�����|������������N� &�``|��a������|�#x��������x~ |x�&������x{��!�a{���K���`��||x@�d;�H``}>�||x@�H;�&{� {� K��`/�|�9>&�@���/�A�}>�||xA���``;���8!���x�&�a��������|���������N� &�``|�,#��������|�+x�&�A���a�����������!�aA��낁�|~�;�;@��x```{� ;�&K���`��/��|`y��xA�@A�<|��9?&{� }?�;�&��K��`/��|`y��x@���``\��H`d�x|ex��xHY`/?/�A�HA�;�K��l``8!�8`�&�A���a�����|������������N� `�/�=A��A��{� /�;{&9 |     �@�t<��@�Hd``;{&B@�9)&})�/�=@���8i&||8!��&�A���a�����|������������N� 8`&||K���9`&}i�K���&�|��A���a��|�#x�&����|�3x��������|~x�����!�a|�+x��K��       |}x��xH�`��P|zx��xH�`C�8`��;Z��;�@�$H�`|��|�;�&K���`{� ��xHe`{� 8&��@}#KxA���8�=|�;�K��`H|���;�&��{� K��`��xH`{� ;�&��@|xA���8`8!��&�A���a�����|������������N� &�|��a������8���������|�+x|~������&8�&;��!�a�b��;�&��xH```{� ;�&K��`��/��|`y��xA�@};�A�8�       &{� ;�&��;�&��K��}`/��|`y��x@���`H`��x|ex��xHM`/?/�A� A�;�K��p```;���8!���x�&�a��������|���������N� &�``}�&|���������|y|�3x��������|�+x|�#x�&�!���A���a�ؑ��!�Q@�@8!�8`���&���!���A��|��a�����}�� �����������N� `K��A|{yA�&���xH&`��x8�&c�xx� H9`/�@�<8`8!��&���!���A��|��a�����}�� �����������N� ��x��xK�����x��x|{x��xK�����P|x����xK��&`|zyA��.@�@Y�x;�|}�;�&xc ��K��`���y;9&A���H`|�{� K��i`8��/�=@���;�&����xH`��|�;�&K��e`��xH�`|�P{� �8&}#KxA���8�|�K��1`@�H_�x��x```��{� ;�&;�&K��&`|�P����A�������C�xK��=`��@��x��x``{� ;�&8���K��`��A���8`K��H``8!���x��x��x��x�&���!���A��|��a�����}�� �����������K����|���������|y�&����8��|�#x�!���A���a�������!�A@�<8!�|x�&�!���A���a��|���������������N� ``��pK����p��x|~x��xK��y;���|yx��H`|�{� K��i`8��/�@���y�P{�c�xK��`/�|zx@��||x;�```|�;�&xc ��K��`���|;�&A���;�&_�x{� ```����x;�&;�&K��&`|�P{� ��A���;{&C�x��K��=`��x��K��`8!�8|x�&�!���A���a��|���������������N� &�`|ix9`8`� /�M� ``�     &9k&}k�/�@���yc N� ``,%|ix8`M� �I/�A�p�}KSx/�A�T8���x�!A�H�@@�@|��H$``�/�@A� B@@��i&8�&/�@��܈}`XP}c�N� �9`K����|ix/�A�4/�M� |��HB@p�     8���9)&x� �&/�@���/�M� 8���9i&x� 88�&|��H```9k&� }i[xB��N� ```N� ,%M� 8���x� x� |ix8�&|����9)&B��N� `,%M� 8���|ixx� 8�&|��`�8�&�     9)&B��N� ```�@@�\|*�@A�P/�M� 9%��8���y) |�*9)&|�*})�9 `|H�|I�9)��B��N� ```/�M� 8���|ixx� 8�&|��`�8�&� 9)&B��N� ```8��+�M� 8c |c�N� ```8��+�M� 8c��|c�N� ```|�|�+x�&�!��|�#x8���|xx�`H�`8!p�&|�N� &�```|��&�!��|`x�b��������|x�������&��!��A�8��H�`8!p�&|�N� &�`|���������|~x�&�����!�q�⁰�K���`��x|ex��xK���`肁�8�|~x�K���`8!����&�����������|�N� &�```|���������|�+x|~x�&����|�#x8�&@�!�1;�p��xH�`��x|}x�~{� K��I`8!&���x�&�����������|�N� &�`|��"������|�#x�&����8��|�+x��������T>|x�!�a+�
�I�)8�!p�AxA�X� @@�|�"�Ȉ     /�A���c8-�8�c9k&�c� ��8&�=p�+�?9)&�?8!�|x�&����������|�����N� ``�+������x��PK��!���?8!�8&|x�}p�i�&�?������|�9)&�����?����N� ``�cK��T&�```|��a������}Cx|�;x�&����|�3x��������|~x|�+x�!�a|�#x8�
1.1       root      153: 8�HQ`/�9 8&|c�A� `��9)&/�})�@���y  |�|��@�@|P|�/�@�0x �>|  �```���>9)&�>B��8!�8`�&�a��������|���������N� &�``|����p���x9�x9�0�&�&��:&��������:� �����&��|�#x|xx�!���A��; �a�������!���A���a�������������������!��;a&P;Ap:���{1�%/�A�8|P��@�,/�%A���#8�&�a&�8c&�a&��%/�@���8��a&�8!&P|xP�&���p|c����x�&��|��!���A���a�����������������&���!���A���a����������������N� `K�x|�+x8%�;�&|�P|
1.1.1.3 ! root      154: ��/�dA��/�iA��/�uA��/�xA��/�XA��/�pA��/�cA��/�sA��/�%A�/�OA��/�o9k&@���9 o9j&}AR}k�}aZ�*p�+p�/�%@� 9#&��!&�8�&�a&�K���`�&q��:&/�0A�/�.:` ;�qA��</�A�P|�:��&�;�8        ��T>+�)@�D8 ��T>+�       A�}z�;�&{� �+�<&/�@���~&�xK��p```�b��x�|�}`Z}i�N� X������������������������������������������������������������������������&������������������������X��������X&h������������������������8�8�
        !           155: ~��x�?H=`x ��xK��]`�@@�D|c�Pxc!A�8/��!&�|i�A��A��```���!&�9)&�!&�B��;�H(`�!&�|��;�&{� �  �!&�8 &�&&���xK���`��@A���K��l``}:�~��x��x8�8� 9�)c�xK����!&�c�x��x8����!&�8     &�&&���&�!&�8 &�&&�K��]�<&K��}:�c�x~��x8�&8�
        !           156: 8� �)9K����!&����a&��<&8c&�a&�K���}:��b��z�$8�~g�x}k9�)~��xc�x�KҐ8~E�xK��-c�x~D�x8�K��͍<&K��x}:��b��z�$8�~g�x}k9�)~��xc�x�KҐ8~E�xK���c�x~D�x8�K��}�<&K��(�<&:�/�h@���<&:�&K��`V�88      ��}:�~6��x�)�9A�4�a&��"��z�$})8-��I�!&��a�8 &}r�8�&&�~E�x8�
1.1       root      157: ~g�x9~��xc�xK��9c�x~D�x8�
                    158: K��ٍ<&K���```�<&:�/�l@��hK��````:`0;�rK���`9 dK���``9 iK��|``9 uK��l9 xK��d9 XK��\9 pK��T9 cK��L9 sK��D9 OK��<8&|  �K�� &�,$|ixA�&@+�$�$@�H&`9)&�$�i/� /   ,�
                    159: A���/�
A���A���A���/�@��/�0A��8�
                    160: /�A��8``8��9K��T>UJ>+�    +
1.1.1.3 ! root      161: 9)&9K��|4@�$8��T>+�}@4@�M� 9k��}`4�(L� �$|c)҉i/�|`@���N� `/�@��|/�08�@��p�        &9I&/�x@��h9*&�$�j&K��P```8`N� �     &9I&/�x@��(9*&�$�j&K���8���K����P���6P�6��7������=��>p�?��A �A��Cp�C��G��Ip�K0�Kp�L�L��M@�M��M��N@�N��N��P �P��S��T@�T��X�X`�YP�[��[��\0�^ �_`�a`�b��f`�g�i �j��k�k0�k`�k��k��k��l�l �lp�l��m`�m��n0�n��o`�op�q��r�t�v��x��y��z@�{��|��~������������������� ��`�����`����������p�������������`������������� p�� 1&)�����a0A ����`E�����������������(� �(�H�`�x�����0��0��P����������X��CPU0logCPU1log��(��p���0�8���h
1.1.1.2   root      162: ELF relocation out of bounds!
                    163: ERROR: Unhandled relocation (A) type %i
1.1.1.3 ! root      164: elf-claim-segmentvirtioblk_read: Access beyond end of device!virtioblk_read failed! status = %i
        !           165: slofVersion check failed, rc = %d
        !           166: Attach failed, rc = %d
        !           167: Walk failed, rc = %d
        !           168: Stat failed, rc = %d
        !           169: Open failed, rc = %d
        !           170: Read failed, rc = %d
        !           171: 
        !           172: Error: %s
        !           173: .9P2000.uunknownfree spaceCreating common NVRAM partition
        !           174: common
        !           175: 0123456789ABCDEF�������������������������������������0FORTH-WORDLIST   ��H*LASTWORD �����EVALUATE ����0�P������������P�(�H���`�������������&��((�@�X* �p8����8��(������BP ��      SEMICOLON�� &0
        !           176: �(RDEPTH!
��8DUP��@LITT�`&=8�`0BRANCH
        !           177: ��HSWAPP�xDROP0��BRANCH
        !           178: ���CLIENTINTERFACE        ���PRINT-STATUS ��������((��H�p�p8���0��(0�H�������pP��������������(8�P�p�����X�p��������QUIT �������H������>������(P���H���`�����(�������x�p�������H����      INTERPRET    ������������(P���p�(� �p���p�������������SAVE-SOURCE ����(�����p��������p�����p������*�-1
        !           179: ����������DOTO        ����������p��������      SOURCE-ID
        !           180: 0�#IB
        !           181: ��`&!��SPAN
        !           182: ��IB
        !           183: 0��DOTICK��8CATCH        ������P�p���8�P���x���P�����X������RESTORE-SOURCE �����������������P�����������P�(�����PTHROW ����(`�P�p�����P�����@�����X������NOOP ����0BOOT-EXCEPTION-HANDLER ���EMIT ��h((FIND)) ����(x��������@�x�(����� ���p�p�������p�������`(FIND) ���2DROP ��X�X���(REVEAL) ���OVER��8&-X�PEXITx��RDEPTH
x�H
        !           184: BREAKPOINT,�p0<��PICK��EPAPR-IMA-SIZE   T+JUMP-CLIENT/l��PRINT-EXCEPTION ���������������(8�H���������X� ����&��(�X� �����SPACE ��P������0=t�`PRINT-STACK ����((��������������OK-STRok�`ABORTED-STRAborted�xCOUNT ������@����xTYPE ���P(�h����������������8
1.1.1.2   root      185: ABORT"-STR
1.1.1.3 ! root      186: ���&@���CR        ���&' ��������( ���@�@�h����&&[ ���������TERMINAL ���P�(�(�p�������P�����DEPTH
�(&. ��p��������REFILL ������(8����������@� ���0��(��� ��e�����INTERPRET-WORD ����P�((�X�����x� �����( �����������������������>IN
        !           187: �°
        !           188: PARSE-WORD   ����Pè���xSTATE
        !           189: ���COMPILE-WORD        ����P�(P���( �����x� �0��� �����( ���������������H���0�0�����H&?LEAVE ����H�h�0�(�p*��(���0����R>��0>Rx�XCELLS+ �Ɛ����CELL+ �������ACCEPT ��#TIB
        !           190: �&�0CATCHER
        !           191: ��hEXECUTE��h?DUP        ����(������DEPTH!
H��STRING, �*���Ƞ���������(DUMBER ��8�p�X��&�8�p��ɨLINEFEED
1.1.1.2   root      192: 
1.1.1.3 ! root      193: ��2DUP ��������xR@���      LINK>NAME    ������ NAME>STRING ��������P      STRING=CID��3DROP    ��X�X�X���0FALSE
        !           194: ʸ2OVER        ����������(LATEST
        !           195: ���&+$�(DO?LEAVE,�HU<��`EPAPR-MAGIC        (˘UNKNOWN-STRUndefined word��HW-EXCEPTION-HANDLER ���LL-CR �ɸ���������0BL
        !           196:  ��NOSHOWSTACK        ����P������SHOW-STACK?
        !           197: 0�.S        ������p�(�X� ���P@���h��h������������������SPACES ����P��������������ưCHAR+ �̘����C@H̸BOUNDS ����H�@����DO?DO��&I ������@�����@DOLOOP8�`XOR��xSET-UNDEFINED-WORD �Ͱ���H͐���Ƞ���@�x�����Ƞ�H�@������H���X�x�����8$FIND ����P�(0�X�����@�p����΀TRUE
        !           198: ��������ΨDOABORT"        ��@�((�P���������������X����OFF ����@����TIB`��RPICK
���(U.) ��Hπ������(.) ��H����� ���h����������EXPECT ���������SOURCE ��(���p���($FIND) �����(0�����@��@����NIP ��@�X���X$NUMBER ������( �X�X�@� ���������-����(x�������h�����((�X�X�X�@� �������������p�����(8�X�@�(Ӱ��� �X�X�X�@��ØSKIPWS ��(��p�����p���(p�����p�H��P��((�H���p�p�������`�X�X���XPARSE ����(���p�H��p���p������p�(0�����H�H�p�����p���x&&\ ����p�h������è����ո
        !           199: IMMEDIATE?   ��������ŸCOMPILE, ��8���h&LEAVE ����H�@�0�(�p*��(���0��ָ?COMP ����p�(� ���������z������LEAVES
        !           200: ��0
        !           201: HASH-TABLE��PCHARS+   �׈��רNA+ ����H���NA1+ ��H�H���XKEY? ���ABORT ��0�����xERASE ��������@SLITERAL �����������H������������������PLACE ����X���@����PH����h�X���H���P���������X���X1+ ��H�H��ـCHARS �������ALLOT �*��H�P*�����DAAR
        !           202: ����C!l��+!        ����p�H�@�����@CARRET
        !           203: 
��TUCK        ��@�����`CONTEXT
        !           204: 0ڀ�LINK>        ������REVEAL ��(�p��@���(�pۈ������3DUP �۸��۸��۸����ۨ&3
        !           205: �8DOLEAVE���&<���
        !           206: ROMFS-BASE��ICBI/0�x
EXCEPTION-STRException #��        SHOWSTACK    ��0�P����� .H �܈�p�@ܨ��܈����Ȑ1- ��H���ƀCA1+ ����H����EVEN �Ƞ�0������DODO�� ALIGNED ��H�h�H�HӰ������OR��h
UNDEFINED-STRundefined word ݨPOCKET ������p��&��H���p�H�H������(�X���������`MOVE��NOT ������EVAL �����`COMP�pU#> ��X�H���p������x<# ��H��������U#S ������(�p�����������X#> ����H���p�����ӠABS ����p�(Ӱ���(#S ��8���p�(�p�����������xSIGN ��p�(��-߈����(FIND-ORDER) �������x���(������p���p�x���((�������X� ��ِ�p�������@����������NAME> ������Ƞ�h� ���>NUMBER ������(� ���܈�p��(��@���@����܈�p�h�@܈�p� ��H�������������h�p���������X���NEGATE ����@�����&> ��@�X���h<= ���������&1
        !           207: &�FINDCHAR        ��@���P����h�H������P��(��p��(0�h������@� ���������@�X�X�����&&( ���)è������
1.1.1.2   root      208: 'IMMEDIATE
1.1.1.3 ! root      209: &�@AND\�X0<>        ��������&, �*����H�����&+LOOP ����H�P�0� �����&] ���&�������p&REPEAT ��������0
        !           210: CLEAN-HASH���CELLS   �������CA+ ����H���HXA+ ���H���x/N* ��H����XA1+ ����H����/N
        !           211: ��KEY        �ذBLANK ��� �����pFILL|��ALIGN �*��H�h���( ���@�p������������DO+LOOP��pU* ������CELL- ��H�����/C* �������CRASH/��0UNLOOP ��������������BS
        !           212: �xSEARCH-ORDER
        !           213: �����HEADER        ���*�ۈ�p�8�(�����@��������LAST ��������8&2
        !           214: ��UNALIGNED-L!D�     FDT-START��(PMC1@/�@.D    �܈�p�@����܈������BASE
        !           215: ���HEX        �� ܈�����0/C
        !           216: &�P2-        �۸����XBFLIP ����0�@�0�x���P&ABORT" ���H�h�0����WHICHPOCKET
        !           217: ���POCKETS���&*��PINVERT        ��0�����xPAD �*���&�H����MU/MOD ������H���@��������`U# �܈�p�H�@��߈��а&# �܈�pވ���߈���8HOLD ��H���p�h���@���X����U>= ��������DIGIT ����H����A��Z���(�����0�������@��( ���@�p�X������UM* ������@���������������X���@ROT ����@���@���pD+ �������H����D2/ ����`����?��p�������U> ��@������      IMMEDIATE    �ۈ�p��������p�@�X����CHAR ����X����ASHIFT(�0<= �������<> ��������&LOOP ����H���0� �����RESOLVE-LOOP ��(�p���(P���p�@*�����@���p��������*���0�(�����P-COMP ��0���p���p�(� �� �X�p�P*����x����&WHILE ������@���0&AGAIN ����H�p�0�x������&THEN ����������HASH��(LA+ ��h�H���X/X* ��������LA1+ ����H����/X
        !           218: �8LCC        �����A��Z���(�� �H����XLFLIPS ���P@�h�h���h�����P������������X, �*����������(C, �*��X�������MIN ������(�@�X����CHAR- �������8CELL
        !           219: �P
        !           220: FLUSHCACHE0�X&J   ����������@���@���@�����@BELL
        !           221: ��CURRENT
        !           222: 0���pUNALIGNED-L@���HEAP-END���MMCR0!.���U.R        ��@�8����X�((������p�X�����xDECIMAL ��@܈�����XH#10
        !           223: �xD#10
1.1.1.2   root      224: 
1.1.1.3 ! root      225: �X2+ �۸�H����BXJOIN ����������x���0XLSPLIT ��������@������pLBFLIP ����@��@�����8LXJOIN �����p���p&C" �����"è�Hǀ�0���@��P(�h��@����������������>>A ��P��ܘOCTAL ��h܈�����8TODIGIT �����        ���(��'�H��0�H����U/MOD  ����@�����UM/MOD ���@����������������X�@���hU<= ��x������&? ��p������UPC �����a��z���(�� �����BETWEEN ��H�H�����WITHIN �������(����� ���(��� �@���*' ������p���@���(��������-ROT ��@���@������CLEAR ���������M+ ��@�������H���������@����0UD2/ ����`����?��p���`����U2/ ��H�����LSHIFT��P2/ ��H�P��͠WORD �Ͱ��è�����X�������P8���h����X�����������X���RSHIFT��>= ��X����&?DO ��`�(�p�H�P�0*�*��(�����0���H+COMP ����p�H���p�(� *��X�����P*�� ���pCOMPILE ��������p�0������THERE
        !           226: ��COMP-BUFFER(�&UNTIL        ����H�(�0�x�����&IF ��`�H�(�0*����0���`&BEGIN ��`*���&(RESOLVE-DEST �*�����0����RESOLVE-ORIG �*�������@����&h      HASH-SIZE
        !           227: �xWA+        �&��H��&�/L* ������̈WA1+ �&��H��&�/L
        !           228: &�XWFLIPS        ���P@�h�h���h�����P����������PX@8�hXLFLIP ����@�x���XX!\hL, �*�`�������MAX ����X�(�@�X���
        !           229: START-RTAS/��UNALIGNED-W!��
        !           230: HEAP-STARTxDEC!0|.R   ��@�p����X�((������p�X����P&8
        !           231: p
1.1.1.2   root      232: H#FFFFFFFF
1.1.1.3 ! root      233: �����XWFLIP        ���@��@���(BLJOIN �p��p��8���LWSPLIT �������@� ����H#20
        !           234:  ��LBSPLIT        ��H���������2SWAP ����������LWFLIP ��H�@8��(&&; ����H���0�`����>> �����FM/MOD ����������p�����������(0�h�@���H�@� ���X��h/' ������p���@���������p�(0���H�p����������0>= ��������PACK �����Ƞ�@�����X�x������D- �8�����D2* ������p��������� DABS ����p�(8���2* ��H����&DO ��`�(�p*��H��0���(�����&.( ���)è����(CISTACK��&AHEAD ��`�H�p�0*����0��@&ENDOF ���������� 8ZCOUNT�ٰ/W* �&������/W
        !           235:         PXBFLIPS ���P@�h�h�0�h�����P���������� �L!�0W, �*� �&�����
        !           236: CALL-C/���UNALIGNED-W@��hPAFLOF-STARTP
        !           237: @DEC@0�
        !           238: `U.        ��8�������&4
        !           239: 
        !           240: �H#FFFF
        !           241: ��� WXJOIN        �8��8���x����XWSPLIT ������H���H��`WLJOIN �� ��p��
        !           242: �BWJOIN        ��h��p��
        !           243: �WBSPLIT        ���
        !           244: ����@�h�����WBFLIP        ���@p��(:NONAME ���*��H ��0�����<< �����pSM/REM ������������ ����p�(Ӱ���p�( Ӱ�@Ӱ�@���M* ���������� ��� � ���p�(8����0> �������xDNEGATE ����Ӱ�������@����?PICK�&." ����p�((p�H���0� ��"è����
(CIREGS�
@&OF ���Ƞ���H���0�H��0���H�X�0������&ELSE ����H�p�0*����0�@�����hRMOVE�
�LBFLIPS ���P@�h ��0�h`���P���������� �L@�PW!�+0WRITE-LOG-BYTE-ENTRY �+P�p��hHSPRG1!.���S. �������H#FF
        !           245: ��XBSPLIT        ��������������*/ �������&: �����H ��0�����S>D ����p���2R@ ���������������@��`&Z" �p���H���@�X�X���&S" ����p�((��H���0� ��"è����Ͱ�����@�x��������EREGS�&ENDCASE ����H�X�0���((�h�@��p������������HLWFLIPS ���P@�h ��H�h`���P�����������HW@��HSPRG1@.��*/MOD ���x������2R> �����������@���&CASE ��`����hWBFLIPS ���P@�h`�h �&��P�����������HSPRG0!.0�MOD ��X��H2>R �������@������2! ���������������`HSPRG0@.X&/ ������8/MOD ����������x-ROLL ������(H������@���H��p�����������(0���@�H��p����������02@ ������p�@�p���SPRG3!-��ROLL ������(0����H��p�����������(0����H��p����������<W@ �`�������(��&���@SPRG3@.��2ROT ���������������ON ��@�@����XSPRG2!-�pSPRG2@-��SPRG1!-@�SPRG1@-h�SPRG0!,��SPRG0@-�HIOR!,�HIOR@,�DABR!,H0DABR@,tHTBU@, `TBL@+�xPIR@+��PVR@+��SDR1!*$�SDR1@+��MSR!)��MSR@)�HID5@)� HID5!)|8HID4@)TPHID4!) hHID1@(��HID1!*��HID0@*��HID0!*t�get-mbx-base*P�get-flash-size+8get-flash-base+0get-nvram-size+\Pget-nvram-base(�xinternal-set-env'��internal-del-env&��internal-add-env%��internal-get-env$�delete-nvram-partition(�@erase-nvram-partition'Dpincrease-nvram-partition$<�new-nvram-partition#��get-named-nvram-partition"��get-nvram-partition"�
        !           246: wipe-nvram$�0nvram-debug$�Xinternal-reset-nvram$�xnvram-x!"`�nvram-x@h�nvram-l!",�nvram-l@@�nvram-w!!�nvram-w@8nvram-c!�Xnvram-c@��ELF-LOAD-FILE-TO-ADDR��
ELF-LOAD-FILEL�bootmsg-checklevel��bootmsg-nvupdate4bootmsg-setlevel�@bootmsg-debugcpx`
bootmsg-error@�bootmsg-warning��
        !           247: bootmsg-cp��virtio-fs-load��virtio-fs-shutdown`virtio-fs-init @8virtio-blk-read�`virtio-blk-shutdown��virtio-blk-init��virtio-get-config\�virtio-get-qsize(virtio-vring-sizeRX!�0RX@!8HRL! �`RL@ �xRW! ��RW@!��RB!!d�RB@!��
        !           248: hv-put-tcehv-send-crqP hv-free-crq @
        !           249: hv-reg-crq�`
        !           250: hv-haschar��
        !           251: hv-getchar��
        !           252: hv-putcharT&o#   ���܈�p������܈����p&h# ���܈�p��ܨ���܈�����&d# ���܈�p�������܈����  &RECURSE ��(�p�0�0�� P&      RECURSIVE    ��`�� �BODY> �۸�`��� �>BODY �۸�`�H�� �BEHAVIOR ����p��!x&TO ������p�((�H�P�0�0� ������"FIND ������P�(H��X�@�@���(Ӱ� ��� ��"`&['] ����H�H�0�0��"�&[CHAR] ��#���#�&POSTPONE ������P���( ���@�@�h�����(0�H�H�0�0�H�0�0����#�&LITERAL ��H���0�0��#h&      [COMPILE]    ����0��$PFIELD �����H
        !           253: X�0���8�H�`��$�
        !           254: END-STRUCT   ��X��$�STRUCT �����%ALIAS �����H ��0���0�`��%pDEFER �����H ��0�H��0�`��%�BUFFER: �����H
        !           255: ��0���`��&8VARIABLE        �����H
        !           256: ��0���0�`��&�VALUE        �����H
        !           257: 0�0�0�`��&�CONSTANT        �����H
        !           258: �0�0�`��'(&DOES>        ��H'@�0��'�DODOES> ������(�p�0������'�CREATE ���'���(($CREATE ���H ��0�H�@���0�`��(`INCLUDE ���(x��)�INCLUDED �)���������P������@��������@�����p�(���������Ƞ�P�������X����)���)�
        !           259: WRITE-FILE   ���MAP-FILE �)�
        !           260: UNMAP-FILE   �����PNICEINIT ��H�X�P���H���P�x�H���P����+����n����H��`�p���8HERE
        !           261: 0��ˀCLIENT-ENTRY-POINT
        !           262: ��+`.WRITE-LOG-BYTE-ENTRY
        !           263: �x�xROMFS-LOOKUP-ENTRY
        !           264: 98hex
1.1       root      265: ' ll-cr to cr
                    266: get-flash-base VALUE flash-addr
                    267: get-nvram-base CONSTANT nvram-base
                    268: get-nvram-size CONSTANT nvram-size
                    269: ff8f9000 CONSTANT sec-nvram-base  \ save area from phype.... not really known
                    270: 2000 CONSTANT sec-nvram-size
                    271: nvram-base 20000 + CONSTANT nvram-log-be1-base
1.1.1.3 ! root      272: 0 CONSTANT default-hvtermno
        !           273: : hvterm-emit  default-hvtermno SWAP hv-putchar ;
        !           274: : hvterm-key?  default-hvtermno hv-haschar ;
        !           275: : hvterm-key   BEGIN hvterm-key? UNTIL default-hvtermno hv-getchar ;
1.1       root      276: ' hvterm-emit to emit
                    277: ' hvterm-key  to key
                    278: ' hvterm-key? to key?
                    279: : serial-emit hvterm-emit ;
                    280: : serial-key? hvterm-key? ;
                    281: : serial-key  hvterm-key  ;
                    282: clean-hash
                    283: : hash-find ( str len head -- 0 | link )
                    284: >r 2dup 2dup hash                  ( str len str len hash          R: head )
                    285: dup >r @ dup                       ( str len str len *hash *hash   R: head hash )
                    286: IF                                 ( str len str len *hash         R: head hash )
                    287: link>name name>string string=ci ( str len true|false            R: head hash )
                    288: dup 0=
                    289: IF
                    290: THEN
                    291: ELSE
                    292: nip nip                         ( str len 0                     R: head hash )
                    293: THEN
                    294: IF                                 \ hash found
                    295: 2drop r> @ r> drop              (  *hash                        R: )
                    296: exit
                    297: THEN                               \ hash not found
                    298: r> r> swap >r ((find))             ( str len head                  R: hash=0 )
                    299: dup
                    300: IF
                    301: dup r> !                        ( link                          R: )
                    302: ELSE
                    303: r> drop                         ( 0                             R: )
                    304: THEN
                    305: ;
                    306: : hash-reveal  hash off ;
                    307: ' hash-reveal to (reveal)
                    308: ' hash-find to (find)
                    309: : >name ( xt -- nfa ) \ note: still has the "immediate" field!
                    310: BEGIN char- dup c@ UNTIL ( @lastchar )
                    311: dup dup aligned - cell+ char- ( @lastchar lenmodcell )
                    312: dup >r -
                    313: BEGIN dup c@ r@ <> WHILE
                    314: cell- r> cell+ >r
                    315: REPEAT
                    316: r> drop char-
                    317: ;
                    318: VARIABLE mask -1 mask !
                    319: VARIABLE huge-tftp-load 1 huge-tftp-load !
                    320: : sms-get-tftp-blocksize 598 ;
                    321: : default-hw-exception s" Exception #" type . ;
                    322: ' default-hw-exception to hw-exception-handler
                    323: : diagnostic-mode? false ;     \ 2B DOTICK'D later in envvar.fs
                    324: : memory-test-suite ( addr len -- fail? )
                    325: diagnostic-mode? IF
                    326: ." Memory test mask value: " mask @ . cr
                    327: ." No memory test suite currently implemented! " cr
                    328: THEN
                    329: false
                    330: ;
                    331: : 0.r  0 swap <# 0 ?DO # LOOP #> type ;
                    332: : cnt-bits  ( 64-bit-value -- #bits=1 )
                    333: dup IF
                    334: 41 1 DO dup 1- and dup 0= IF drop i LEAVE THEN LOOP
                    335: THEN
                    336: ;
                    337: : bcd-to-bin  ( bcd -- bin )
                    338: dup f and swap 4 rshift a * +
                    339: ;
                    340: : 2log ( n -- lb{n} )
                    341: 8 cells 0 DO 1 rshift dup 0= IF drop i LEAVE THEN LOOP
                    342: ;
                    343: : log2  ( n -- log2-n )
                    344: 1- 2log 1+
                    345: ;
                    346: CREATE $catpad 100 allot
                    347: : $cat ( str1 len1 str2 len2 -- str3 len3 )
                    348: >r >r dup >r $catpad swap move
                    349: r> dup $catpad + r> swap r@ move
                    350: r> + $catpad swap ;
                    351: : $cat-comma ( str2 len2 str1 len1 -- "str1, str2" len1+len2+2 )
                    352: 2dup + s" , " rot swap move 2+ 2swap $cat
                    353: ;
                    354: : $cat-space ( str2 len2 str1 len1 -- "str1 str2" len1+len2+1 )
                    355: 2dup + bl swap c! 1+ 2swap $cat
                    356: ;
                    357: : $cathex ( str len val -- str len' )
                    358: (u.) $cat
                    359: ;
1.1.1.2   root      360: : 2CONSTANT    CREATE , , DOES> [ here ] 2@ ;
                    361: CONSTANT <2constant>
1.1       root      362: : $2CONSTANT  $CREATE , , DOES> 2@ ;
                    363: : 2VARIABLE    CREATE 0 , 0 ,  DOES> ;
                    364: : (is-user-word) ( name-str name-len xt -- ) -rot $CREATE , DOES> @ execute ;
                    365: : zplace ( str len buf -- )  2dup + 0 swap c! swap move ;
                    366: : rzplace ( str len buf -- )  2dup + 0 swap rb! swap rmove ;
                    367: : strdup ( str len -- dupstr len ) here over allot swap 2dup 2>r move 2r> ;
                    368: : str= ( str1 len1 str2 len2 -- equal? )
                    369: rot over <> IF 3drop false ELSE comp 0= THEN ;
1.1.1.3 ! root      370: : test-string ( param len -- true | false )
        !           371: 0 ?DO
        !           372: dup i + c@                     \ Get character / byte at current index
        !           373: dup 20 <  swap 7e >  OR IF     \ Is it out of range 32 to 126 (=ASCII)
        !           374: drop FALSE UNLOOP EXIT      \ FALSE means: No ASCII string
        !           375: THEN
        !           376: LOOP
        !           377: drop TRUE    \ Only ASCII found --> it is a string
        !           378: ;
1.1       root      379: : #aligned ( adr alignment -- adr' ) negate swap negate and negate ;
                    380: : #join  ( lo hi #bits -- x )  lshift or ;
                    381: : #split ( x #bits -- lo hi )  2dup rshift dup >r swap lshift xor r> ;
                    382: : /string ( str len u -- str' len' )
                    383: >r swap r@ chars + swap r> - ;
                    384: : skip ( str len c -- str' len' )
                    385: >r BEGIN dup WHILE over c@ r@ = WHILE 1 /string REPEAT THEN r> drop ;
                    386: : scan ( str len c -- str' len' )
                    387: >r BEGIN dup WHILE over c@ r@ <> WHILE 1 /string REPEAT THEN r> drop ;
                    388: : split ( str len char -- left len right len )
                    389: >r 2dup r> findchar IF >r over r@ 2swap r> 1+ /string ELSE 0 0 THEN ;
                    390: : rfindchar ( str len char -- offs true | false )
                    391: swap 1 - 0 swap do
                    392: over i + c@
                    393: over dup bl = if <= else = then if
                    394: 2drop i dup dup leave
                    395: then
                    396: -1 +loop =
                    397: ;
                    398: : rsplit ( str len char -- left len right len )
                    399: >r 2dup r> rfindchar IF >r over r@ 2swap r> 1+ /string ELSE 0 0 THEN ;
                    400: : left-parse-string ( str len char -- R-str R-len L-str L-len )
                    401: split 2swap ;
                    402: : replace-char ( str len chout chin -- )
                    403: >r -rot BEGIN 2dup 4 pick findchar WHILE tuck - -rot + r@ over c! swap REPEAT
                    404: r> 2drop 2drop
                    405: ;
                    406: : \-to-/ ( str len -- str' len ) strdup 2dup [char] \ [char] / replace-char ;
1.1.1.3 ! root      407: : isdigit ( char -- true | false )
        !           408: 30 39 between
        !           409: ;
1.1       root      410: : //  dup >r 1- + r> / ; \ division, round up
                    411: : c@+ ( adr -- c adr' )  dup c@ swap char+ ;
                    412: : 2c@ ( adr -- c1 c2 )  c@+ c@ ;
                    413: : 4c@ ( adr -- c1 c2 c3 c4 )  c@+ c@+ c@+ c@ ;
                    414: : 8c@ ( adr -- c1 c2 c3 c4 c5 c6 c7 c8 )  c@+ c@+ c@+ c@+ c@+ c@+ c@+ c@ ;
                    415: : 4dup  ( n1 n2 n3 n4 -- n1 n2 n3 n4 n1 n2 n3 n4 )  2over 2over ;
                    416: : 4drop  ( n1 n2 n3 n4 -- )  2drop 2drop ;
                    417: : 6dup  ( 1 2 3 4 5 6 -- 1 2 3 4 5 6 1 2 3 4 5 6 )
                    418: 5 pick 5 pick 5 pick 5 pick 5 pick 5 pick
                    419: ;
                    420: : signed ( n1 -- n2 ) dup 80000000 and IF FFFFFFFF00000000 or THEN ;
                    421: : <l@ ( addr -- x ) l@ signed ;
                    422: : -leading  BEGIN dup WHILE over c@ bl <= WHILE 1 /string REPEAT THEN ;
                    423: : (parse-line)  skipws 0 parse ;
                    424: : hex-byte ( char0 char1 -- value true|false )
                    425: 10 digit IF
                    426: swap 10 digit IF
                    427: 4 lshift or true EXIT
                    428: ELSE
                    429: 2drop 0
                    430: THEN
                    431: ELSE
                    432: drop
                    433: THEN
                    434: false EXIT
                    435: ;
                    436: : parse-hexstring ( dst-adr -- dst-adr' )
                    437: [char] ) parse cr                 ( dst-adr str len )
                    438: bounds ?DO                        ( dst-adr )
                    439: i c@ i 1+ c@ hex-byte IF       ( dst-adr hex-byte )
                    440: >r dup r> swap c! 1+ 2      ( dst-adr+1 2 )
                    441: ELSE
                    442: drop 1                      ( dst-adr 1 )
                    443: THEN
                    444: +LOOP
                    445: ;
                    446: : add-specialchar ( dst-adr special -- dst-adr' )
                    447: over c! 1+                        ( dst-adr' )
                    448: 1 >in +!                          \ advance input-index
                    449: ;
                    450: : parse-" ( dst-adr -- dst-adr' )
                    451: [char] " parse dup 3 pick + >r    ( dst-adr str len R: dst-adr' )
                    452: >r swap r> move r>                ( dst-adr' )
                    453: ;
                    454: : (") ( dst-adr -- dst-adr' )
                    455: begin                             ( dst-adr )
                    456: parse-"                        ( dst-adr' )
                    457: >in @ dup span @ >= IF         ( dst-adr' >in-@ )
                    458: drop
                    459: EXIT
                    460: THEN
                    461: ib + c@
                    462: CASE
                    463: [char] ( OF parse-hexstring ENDOF
                    464: [char] " OF [char] " add-specialchar ENDOF
                    465: dup      OF EXIT ENDOF
                    466: ENDCASE
                    467: again
                    468: ;
                    469: CREATE "pad 100 allot
                    470: : " ( [text<">< >] -- text-str text-len )
                    471: state @ IF                        \ compile sliteral, pstr into dict
                    472: "pad dup (") over -            ( str len )
                    473: ['] sliteral compile, dup c,   ( str len )
                    474: bounds ?DO i c@ c, LOOP
                    475: align ['] count compile,
                    476: ELSE
                    477: pocket dup (") over -          \ Interpretation, put string
                    478: THEN                              \ in temp buffer
                    479: ; immediate
1.1.1.3 ! root      480: : (cr carret emit ;
1.1       root      481: : $forget ( str len -- )
                    482: 2dup last @            ( str len str len last-bc )
                    483: BEGIN
                    484: dup >r             ( str len str len last-bc R: last-bc )
                    485: cell+ char+ count  ( str len str len found-str found-len R: last-bc )
                    486: string=ci IF       ( str len R: last-bc )
                    487: r> @ last ! 2drop clean-hash EXIT ( -- )
                    488: THEN
                    489: 2dup r> @ dup 0=   ( str len str len next-bc next-bc )
                    490: UNTIL
                    491: drop 2drop 2drop            \ clean hash table
                    492: ;
                    493: : forget ( "old-name<>" -- )
                    494: parse-word $forget
                    495: ;
                    496: : linked ( var -- )  here over @ , swap ! ;
                    497: HEX
                    498: VARIABLE wordlists  forth-wordlist wordlists !
                    499: : wordlist ( -- wid )  here wordlists linked 0 , ;
                    500: 10 CONSTANT max-in-search-order        \ should define elsewhere
                    501: : also ( -- )  clean-hash  context dup cell+ dup to context  >r @ r> ! ;
                    502: : previous ( -- )  clean-hash  context cell- to context ;
                    503: : only ( -- )  clean-hash  search-order to context  ( minimal-wordlist search-order ! ) ;
                    504: : seal ( -- )  clean-hash  context @  search-order dup to context  ! ;
                    505: : get-order ( -- wid_n .. wid_1 n )
                    506: context >r search-order BEGIN dup r@ u<= WHILE
                    507: dup @ swap cell+ REPEAT r> drop
                    508: search-order - cell / ;
                    509: : set-order ( wid_n .. wid_1 n -- )    \ XXX: special cases for 0, -1
                    510: clean-hash  1- cells search-order + dup to context
                    511: BEGIN dup search-order u>= WHILE
                    512: dup >r ! r> cell- REPEAT drop ;
                    513: : get-current ( -- wid )  current ;
                    514: : set-current ( wid -- )  to current ;
                    515: : definitions ( -- )  context @ set-current ;
                    516: : VOCABULARY ( C: "name" -- ) ( -- )  CREATE wordlist drop  DOES> clean-hash  context ! ;
                    517: : FORTH ( -- )  clean-hash  forth-wordlist context ! ;
                    518: : .voc ( wid -- ) \ display name for wid \ needs work ( body> or something like that )
                    519: dup cell- @ ['] vocabulary ['] forth within IF
                    520: 2 cells - >name name>string type ELSE u. THEN  space ;
                    521: : vocs ( -- ) \ display all wordlist names
                    522: cr wordlists BEGIN @ dup WHILE dup .voc REPEAT drop ;
                    523: : order ( -- )
                    524: cr ." context:  " get-order 0 ?DO .voc LOOP
                    525: cr ." current:  " get-current .voc ;
                    526: : voc-find ( wid -- 0 | link )
                    527: clean-hash  cell+ @ (find)  clean-hash ;
                    528: : (function) ;
                    529: defer (defer)
                    530: 0 value (value)
                    531: 0 constant (constant)
                    532: variable (variable)
                    533: create (create)
                    534: alias (alias) (function)
                    535: cell buffer: (buffer:)
                    536: ' (function) @        \ ( <colon> )
                    537: ' (function) cell + @ \ ( ... <semicolon> )
                    538: ' (defer) @           \ ( ... <defer> )
                    539: ' (value) @           \ ( ... <value> )
                    540: ' (constant) @       \ ( ... <constant> )
                    541: ' (variable) @        \ ( ... <variable> )
                    542: ' (create) @          \ ( ... <create> )
                    543: ' (alias) @           \ ( ... <alias> )
                    544: ' (buffer:) @         \ ( ... <buffer:> )
                    545: forget (function)
                    546: constant <buffer:>
                    547: constant <alias>
                    548: constant <create>
                    549: constant <variable>
                    550: constant <constant>
                    551: constant <value>
                    552: constant <defer>
                    553: constant <semicolon>
                    554: constant <colon>
                    555: ' lit      constant <lit>
                    556: ' sliteral constant <sliteral>
                    557: ' 0branch  constant <0branch>
                    558: ' branch   constant <branch>
                    559: ' doloop   constant <doloop>
                    560: ' dotick   constant <dotick>
                    561: ' doto     constant <doto>
                    562: ' do?do    constant <do?do>
                    563: ' do+loop  constant <do+loop>
                    564: ' do       constant <do>
                    565: ' exit     constant <exit>
                    566: ' doleave  constant <doleave>
                    567: ' do?leave  constant <do?leave>
                    568: 500 CONSTANT AVAILABLE-SIZE
                    569: 4000 CONSTANT MIN-RAM-RESERVE \ prevent from using first pages
1.1.1.2   root      570: : MIN-RAM-SIZE         \ Initially available memory size
                    571: epapr-ima-size IF
                    572: epapr-ima-size
                    573: ELSE
1.1.1.3 ! root      574: 20000000         \ assumed minimal memory size
1.1.1.2   root      575: THEN
                    576: ;
1.1.1.3 ! root      577: MIN-RAM-SIZE CONSTANT MIN-RAM-SIZE
1.1       root      578: STRUCT
                    579: cell field available>address
                    580: cell field available>size
                    581: CONSTANT /available
                    582: CREATE available AVAILABLE-SIZE /available * allot available AVAILABLE-SIZE /available * erase
                    583: VARIABLE mem-pre-released 0 mem-pre-released !
                    584: : available>size@      available>size @ ;
                    585: : available>address@   available>address @ ;
                    586: : available>size!      available>size ! ;
                    587: : available>address!   available>address ! ;
                    588: : available! ( addr size available-ptr -- )
                    589: dup -rot available>size! available>address!
                    590: ;
                    591: : available@ ( available-ptr -- addr size )
                    592: dup available>address@ swap available>size@
                    593: ;
                    594: : (?available-segment<) ( start1 end1 start2 end2 -- true/false ) drop < nip ;
                    595: : (?available-segment>) ( start1 end1 start2 end2 -- true/false ) -rot 2drop > ;
                    596: : (?available-segment-#) ( start1 end1 start2 end2 -- true/false )
                    597: 2dup 5 roll -rot                ( e1 s2 e2 s1 s2 e2 )
                    598: between >r between r> and not
                    599: ;
                    600: : (find-available) ( addr addr+size-1 a-ptr a-size -- a-ptr' found )
                    601: ?dup 0= IF -rot 2drop false EXIT THEN  \ Not Found
                    602: 2dup 2/ dup >r /available * +
                    603: dup available>size@ 0= IF 2drop r> RECURSE EXIT THEN
                    604: dup >r available@
                    605: over + 1- 2>r 2swap
                    606: 2dup 2r@ (?available-segment>) IF
                    607: 2swap 2r> 2drop r>
                    608: /available + -rot r> - 1- nip RECURSE EXIT     \ Look Right
                    609: THEN
                    610: 2dup 2r@ (?available-segment<) IF
                    611: 2swap 2r> 2drop r>
                    612: 2drop r> RECURSE EXIT  \ Look Left
                    613: THEN
                    614: 2dup 2r@ (?available-segment-#) IF     \ Conflict - segments overlap
                    615: 2r> 2r> 3drop 3drop 2drop
                    616: 1212 throw
                    617: THEN
                    618: 2r> 3drop 3drop r> r> drop     ( a-ptr' -- )
                    619: dup available>size@ 0<>                ( a-ptr' found -- )
                    620: ;
                    621: : (find-available) ( addr size -- seg-ptr found )
                    622: over + 1- available AVAILABLE-SIZE ['] (find-available) catch IF
                    623: 2drop 2drop 0 false
                    624: THEN
                    625: ;
                    626: : dump-available ( available-ptr -- )
                    627: cr
                    628: dup available - /available / AVAILABLE-SIZE swap - 0 ?DO
                    629: dup available@ ?dup 0= IF
                    630: 2drop UNLOOP EXIT
                    631: THEN
                    632: swap . . cr
                    633: /available +
                    634: LOOP
                    635: dup
                    636: ;
                    637: : .available available dump-available ;
                    638: : (drop-available) ( available-ptr -- )
                    639: dup available - /available /   \ current element index
                    640: AVAILABLE-SIZE swap -          \ # of remaining elements
                    641: ( first nelements ) 1- 0 ?DO
                    642: dup /available + dup available@
                    643: ( current next next>address next>size ) ?dup 0= IF
                    644: 2drop LEAVE \ NULL element - goto last copy
                    645: THEN
                    646: 3 roll available!              ( next )
                    647: LOOP
                    648: 0 0 rot available!
                    649: ;
                    650: : (stick-to-previous-available) ( addr size available-ptr -- naddr nsize nptr success )
                    651: dup available = IF
                    652: false EXIT             \ This was the first available segment
                    653: THEN
                    654: dup /available - dup available@
                    655: + 4 pick = IF
                    656: nip    \ Drop available-ptr since we are going to previous one
                    657: rot drop       \ Drop start addr, we take the previous one
                    658: dup available@ 3 roll + rot true
                    659: ELSE
                    660: drop false
                    661: THEN
                    662: ;
                    663: : (insert-available) ( available-ptr -- available-ptr )
                    664: dup                            \ current element
                    665: dup available - /available /   \ current element index
                    666: AVAILABLE-SIZE swap -          \ # of remaining elements
                    667: dup 0<= 3 pick available>size@ 0= or IF
                    668: drop drop EXIT
                    669: THEN
                    670: over available@ rot
                    671: ( first        first/=current/ first>address first>size nelements ) 1- 0 ?DO
                    672: 2>r
                    673: /available + dup available@
                    674: 2r> 4 pick available! dup 0= IF
                    675: rot /available + available!
                    676: UNLOOP EXIT
                    677: THEN
                    678: LOOP
                    679: ( first next/=last/ last[0]>address last[0]>size ) ?dup 0<> IF
                    680: cr ." release error: available map overflow"
                    681: cr ." Dumping available property"
                    682: .available
                    683: cr ." No space for one before last entry:" cr swap . .
                    684: cr ." Dying ..." cr 123 throw
                    685: THEN
                    686: 2drop
                    687: ;
                    688: : insert-available ( addr size available-ptr -- addr size available-ptr )
                    689: dup available>address@ 0<> IF
                    690: dup available>address@ rot dup -rot -
                    691: 3 pick = IF    \ if (available>address@ - size == addr)
                    692: over available>size@ + swap
                    693: (stick-to-previous-available) IF
                    694: dup /available + (drop-available)
                    695: THEN
                    696: ELSE
                    697: swap (stick-to-previous-available)
                    698: not IF (insert-available) THEN
                    699: THEN
                    700: ELSE
                    701: (stick-to-previous-available) drop
                    702: THEN
                    703: ;
                    704: defer release
                    705: : drop-available ( addr size available-ptr -- addr )
                    706: dup >r available@
                    707: over 4 pick swap - ?dup 0<> IF
                    708: dup 3 roll swap r> available! -
                    709: over - ?dup 0= IF
                    710: drop
                    711: ELSE
                    712: swap 2 pick + swap release
                    713: THEN
                    714: ELSE
                    715: nip ( req_addr req_size segment_size )
                    716: over - ?dup 0= IF
                    717: drop r> (drop-available)
                    718: ELSE
                    719: -rot over + rot r> available!
                    720: THEN
                    721: THEN
                    722: ;
                    723: : pwr2roundup ( value -- pwr2value )
                    724: dup CASE
                    725: 0 OF EXIT ENDOF
                    726: 1 OF EXIT ENDOF
                    727: ENDCASE
                    728: dup 1 DO drop i dup +LOOP
                    729: dup +
                    730: ;
                    731: : (claim-best-fit) ( len align -- len base )
                    732: pwr2roundup 1- -1 -1
                    733: available AVAILABLE-SIZE /available * + available DO
                    734: i              \ Must be saved now, before we use Return stack
                    735: -rot >r >r swap >r
                    736: available@ ?dup 0= IF drop r> r> r> LEAVE THEN         \ EOL
                    737: 2 pick - dup 0< IF
                    738: 2drop                  \ Can't Fit: Too Small
                    739: ELSE
                    740: dup 2 pick r@ and - 0< IF
                    741: 2drop          \ Can't Fit When Aligned
                    742: ELSE
                    743: r> -rot dup r@ U< IF
                    744: 2r> 2drop
                    745: swap 2 pick + 2 pick invert and >r >r >r
                    746: ELSE
                    747: 2drop >r
                    748: THEN
                    749: THEN
                    750: THEN
                    751: r> r> r>
                    752: /available +LOOP
                    753: -rot 2drop     ( len best-fit-base/or -1 if none found/ )
                    754: ;
                    755: : (adjust-release0) ( 0 size -- addr' size' )
                    756: 2dup MIN-RAM-SIZE dup 3 roll + -rot -
                    757: dup 0< IF 2drop ELSE
                    758: 2swap 2drop 0 mem-pre-released !
                    759: THEN
                    760: ;
                    761: : claim ( [ addr ] len align -- base )
                    762: ?dup 0<> IF
                    763: (claim-best-fit) dup -1 = IF
                    764: 2drop cr ." claim error : aligned allocation failed" cr
                    765: ." available:" cr .available
                    766: 321 throw EXIT
                    767: THEN
                    768: swap
                    769: THEN
                    770: 2dup (find-available) not IF
                    771: drop
                    772: 2drop
                    773: 321 throw EXIT
                    774: THEN
                    775: ( req_addr req_size available-ptr ) drop-available
                    776: ;
                    777: : .release ( addr len -- )
                    778: over 0= mem-pre-released @ and IF (adjust-release0) THEN
                    779: 2dup (find-available) IF
                    780: drop swap
                    781: cr ." release error: region " . ." , " . ." already released" cr
                    782: ELSE
                    783: ?dup 0= IF
                    784: swap 
                    785: cr ." release error: Bad/conflicting region " . ." , " .
                    786: ." or available list full " cr
                    787: ELSE
                    788: ( addr size available-ptr ) insert-available
                    789: ( addr size available-ptr ) available!
                    790: THEN
                    791: THEN
                    792: ;
                    793: ' .release to release
                    794: 0 MIN-RAM-SIZE release 1 mem-pre-released !
                    795: 0 MIN-RAM-RESERVE 0 ' claim CATCH IF ." claim failed!" cr 2drop THEN drop
1.1.1.2   root      796: paflof-start ffff not and 1f00000 0 ' claim CATCH IF
                    797: ." claim failed!" cr 2drop
                    798: THEN drop
1.1       root      799: heap-end heap-start - log2 1+ CONSTANT (max-heads#)
                    800: CREATE heads (max-heads#) cells allot
                    801: heads (max-heads#) cells erase
                    802: : size>head  ( size -- headptr )  log2 3 max cells heads + ;
                    803: : alloc-mem  ( len -- a-addr )
                    804: dup 0= IF EXIT THEN
                    805: 1 over log2 3 max                   ( len 1 log_len )
                    806: dup (max-heads#) >= IF cr ." Out of internal memory." cr 3drop 0 EXIT THEN
                    807: lshift >r                           ( len  R: 1<<log_len )
                    808: size>head dup @ IF
                    809: dup @ dup >r @ swap ! r> r> drop EXIT
                    810: THEN                                ( headptr  R: 1<<log_len)
                    811: r@ 2* recurse dup                   ( headptr a-addr2 a-addr2  R: 1<<log_len)
                    812: dup 0= IF r> 2drop 2drop 0 EXIT THEN
                    813: r> + >r 0 over ! swap ! r>
                    814: ;
                    815: : free-mem  ( a-addr len -- )
                    816: dup 0= IF 2drop EXIT THEN size>head 2dup @ swap ! !
                    817: ;
                    818: : #links  ( a -- n )
                    819: @ 0 BEGIN over WHILE 1+ swap @ swap REPEAT nip
                    820: ;
                    821: : .free  ( -- )
                    822: 0 (max-heads#) 0 DO
                    823: heads i cells + #links dup IF
                    824: cr dup . ." * " 1 i lshift dup . ." = " * dup .
                    825: THEN
                    826: +
                    827: LOOP
                    828: cr ." Total " .
                    829: ;
                    830: heap-start heap-end heap-start - free-mem
                    831: VARIABLE device-tree
                    832: VARIABLE current-node
                    833: : get-node  current-node @ dup 0= ABORT" No active device tree node" ;
                    834: STRUCT
                    835: cell FIELD node>peer
                    836: cell FIELD node>parent
                    837: cell FIELD node>child
                    838: cell FIELD node>properties
                    839: cell FIELD node>words
1.1.1.3 ! root      840: cell FIELD node>instance-template
1.1       root      841: cell FIELD node>instance-size
                    842: cell FIELD node>space?
                    843: cell FIELD node>space
                    844: cell FIELD node>addr1
                    845: cell FIELD node>addr2
                    846: cell FIELD node>addr3
                    847: END-STRUCT
                    848: : find-method ( str len phandle -- false | xt true )
                    849: node>words @ voc-find dup IF link> true THEN ;
                    850: 0 VALUE my-self
1.1.1.3 ! root      851: 400 CONSTANT max-instance-size
        !           852: STRUCT
        !           853: /n FIELD instance>node
        !           854: /n FIELD instance>parent
        !           855: /n FIELD instance>args
        !           856: /n FIELD instance>args-len
        !           857: /n FIELD instance>size
        !           858: /n FIELD instance>#units
        !           859: /n FIELD instance>unit1          \ For instance-specific "my-unit"
        !           860: /n FIELD instance>unit2
        !           861: /n FIELD instance>unit3
        !           862: /n FIELD instance>unit4
        !           863: CONSTANT /instance-header
        !           864: : >instance  ( offset -- myself+offset )
1.1       root      865: my-self 0= ABORT" No instance!"
1.1.1.3 ! root      866: dup my-self instance>size @ >= ABORT" Instance access out of bounds!"
1.1       root      867: my-self +
                    868: ;
                    869: : (create-instance-var) ( initial-value -- )
1.1.1.3 ! root      870: get-node
        !           871: dup node>instance-size @ cell+ max-instance-size
        !           872: >= ABORT" Instance is bigger than max-instance-size!"
        !           873: dup node>instance-template @      ( iv phandle tmp-ih )
1.1       root      874: swap node>instance-size dup @     ( iv tmp-ih *instance-size instance-size )
                    875: dup ,                             \ compile current instance ptr
                    876: swap 1 cells swap +!              ( iv tmp-ih instance-size )
                    877: + !
                    878: ;
                    879: : create-instance-var ( "name" initial-value -- )
1.1.1.3 ! root      880: CREATE (create-instance-var) PREVIOUS
        !           881: ;
        !           882: : (create-instance-buf) ( buffersize -- )
        !           883: aligned                               \ align size to multiples of cells
        !           884: dup get-node node>instance-size @ +   ( buffersize' newinstancesize )
        !           885: max-instance-size > ABORT" Instance is bigger than max-instance-size!"
        !           886: get-node node>instance-template @  get-node node>instance-size @ +
        !           887: over erase                            \ clear according to IEEE 1275
        !           888: get-node node>instance-size @         ( buffersize' old-instance-size )
        !           889: dup ,                                 \ compile current instance ptr
        !           890: + get-node node>instance-size !       \ store new size
        !           891: ;
        !           892: : create-instance-buf ( "name" buffersize -- )
        !           893: CREATE (create-instance-buf) PREVIOUS
        !           894: ;
1.1       root      895: VOCABULARY instance-words  ALSO instance-words DEFINITIONS
1.1.1.2   root      896: : VARIABLE  0 create-instance-var DOES> [ here ] @ >instance ;
                    897: : VALUE       create-instance-var DOES> [ here ] @ >instance @ ;
                    898: : DEFER     0 create-instance-var DOES> [ here ] @ >instance @ execute ;
1.1.1.3 ! root      899: : BUFFER:     create-instance-buf DOES> [ here ] @ >instance ;
1.1       root      900: PREVIOUS DEFINITIONS
1.1.1.3 ! root      901: CONSTANT <instancebuffer>
1.1.1.2   root      902: CONSTANT <instancedefer>
                    903: CONSTANT <instancevalue>
                    904: CONSTANT <instancevariable>
1.1       root      905: : (instance?) ( xt -- xt true|false )
                    906: dup @ <create> = IF
                    907: dup cell+ @ cell+ @ ['] >instance =
                    908: ELSE
                    909: false
                    910: THEN
                    911: ;
                    912: : (doito) ( value R:*CFA -- )
                    913: r> cell+ dup >r
                    914: @ cell+ cell+ @ >instance !
                    915: ;
1.1.1.3 ! root      916: ' (doito) CONSTANT <(doito)>
1.1       root      917: : to ( value wordname<> -- )
                    918: ' (instance?)
                    919: state @ IF
                    920: IF ['] (doito) ELSE ['] DOTO THEN
                    921: , , EXIT
                    922: THEN
                    923: IF
                    924: cell+ cell+ @ >instance ! \ interp mode instance value
                    925: ELSE
                    926: cell+ !                   \ interp mode normal value
                    927: THEN
                    928: ; IMMEDIATE
1.1.1.3 ! root      929: : behavior  ( defer-xt -- contents-xt )
        !           930: dup cell+ @ <instancedefer> = IF   \ Is defer-xt an INSTANCE DEFER ?
        !           931: 2 cells + @ >instance @
        !           932: ELSE
        !           933: behavior
        !           934: THEN
        !           935: ;
1.1       root      936: : INSTANCE  ALSO instance-words ;
                    937: : my-parent  my-self instance>parent @ ;
1.1.1.3 ! root      938: : my-args    my-self instance>args 2@ swap ;
1.1       root      939: : set-my-args   ( old-addr len -- )
                    940: dup IF                             \ IF len > 0                    ( old-addr len )
                    941: dup alloc-mem                   \ | allocate space for new args ( old-addr len new-addr )
1.1.1.3 ! root      942: 2dup my-self instance>args 2!   \ | write into instance struct  ( old-addr len new-addr )
        !           943: swap move                       \ | and copy the args           ( )
1.1       root      944: ELSE                               \ ELSE                          ( old-addr len )
                    945: my-self instance>args 2!        \ | set new args to zero, too   ( )
                    946: THEN                               \ FI
                    947: ;
                    948: : create-instance-data ( -- instance )
1.1.1.3 ! root      949: get-node dup node>instance-template @    ( phandle instance-template )
        !           950: swap node>instance-size @                ( instance-template instance-size )
        !           951: dup >r
        !           952: dup alloc-mem dup >r swap move r>        ( instance )
        !           953: dup instance>size r> swap !              \ Store size for destroy-instance
        !           954: dup instance>#units 0 swap !             \ Use node unit by default
1.1       root      955: ;
                    956: : create-instance ( -- )
                    957: my-self create-instance-data
                    958: dup to my-self instance>parent !
                    959: get-node my-self instance>node !
                    960: ;
                    961: : destroy-instance ( instance -- )
1.1.1.3 ! root      962: dup instance>args @ ?dup IF               \ Free instance args?
        !           963: over instance>args-len @  free-mem
        !           964: THEN
        !           965: dup instance>size @  free-mem
1.1       root      966: ;
                    967: : ihandle>phandle ( ihandle -- phandle )
                    968: dup 0= ABORT" no current instance" instance>node @
                    969: ;
                    970: : push-my-self ( ihandle -- )  r> my-self >r >r to my-self ;
                    971: : pop-my-self ( -- )  r> r> to my-self >r ;
                    972: : call-package  push-my-self execute pop-my-self ;
                    973: : $call-static ( ... str len node -- ??? )
                    974: find-method IF execute ELSE -1 throw THEN
                    975: ;
1.1.1.3 ! root      976: : $call-my-method  ( str len -- )
        !           977: my-self ihandle>phandle $call-static
        !           978: ;
        !           979: : $call-method  ( str len ihandle -- )
        !           980: push-my-self
        !           981: ['] $call-my-method CATCH ?dup IF
        !           982: pop-my-self THROW
        !           983: THEN
        !           984: pop-my-self
        !           985: ;
        !           986: 0 VALUE calling-child
        !           987: : $call-parent
        !           988: my-self ihandle>phandle TO calling-child
        !           989: my-parent $call-method
        !           990: 0 TO calling-child
        !           991: ;
1.1       root      992: : create-node ( parent -- new )
1.1.1.2   root      993: max-instance-size alloc-mem        ( parent instance-mem )
                    994: dup max-instance-size erase >r     ( parent  R: instance-mem )
                    995: align wordlist >r wordlist >r      ( parent  R: instance-mem wl wl )
                    996: here                               ( parent new  R: instance-mem wl wl )
                    997: 0 , swap , 0 ,                     \ Set node>peer, node>parent & node>child
                    998: r> , r> ,                          \ Set node>properties & node>words to wl
1.1.1.3 ! root      999: r> , /instance-header ,            \ Set instance-template & instance-size
1.1.1.2   root     1000: FALSE , 0 ,                        \ Set node>space? and node>space
                   1001: 0 , 0 , 0 ,                        \ Set node>addr*
                   1002: ;
1.1       root     1003: : peer    node>peer   @ ;
                   1004: : parent  node>parent @ ;
                   1005: : child   node>child  @ ;
                   1006: : peer  dup IF peer ELSE drop device-tree @ THEN ;
                   1007: : link ( new head -- ) \ link a new node at the end of a linked list
                   1008: BEGIN dup @ WHILE @ REPEAT ! ;
                   1009: : link-node ( parent child -- )
                   1010: swap dup IF node>child link ELSE drop device-tree ! THEN ;
                   1011: : set-node ( phandle -- )
                   1012: current-node @ IF previous THEN
                   1013: dup current-node !
                   1014: ?dup IF node>words @ also context ! THEN
                   1015: definitions ;
                   1016: : get-parent  get-node parent ;
                   1017: : new-node ( -- phandle ) \ active node becomes new node's parent;
                   1018: current-node @ dup create-node
                   1019: tuck link-node dup set-node ;
                   1020: : finish-node ( -- )
1.1.1.3 ! root     1021: get-node parent set-node
        !          1022: ;
1.1       root     1023: : device-end ( -- )  0 set-node ;
                   1024: CREATE $indent 100 allot  VARIABLE indent 0 indent !
                   1025: true value encode-first?
                   1026: : decode-int  over >r 4 /string r> 4c@ swap 2swap swap bljoin ;
                   1027: : decode-64 decode-int -rot decode-int -rot 2swap swap lxjoin ;
                   1028: : decode-string ( prop-addr1 prop-len1 -- prop-addr2 prop-len2 str len )
                   1029: dup 0= IF 2dup EXIT THEN \ string properties with zero lenght
                   1030: over BEGIN dup c@ 0= IF 1+ -rot swap 2 pick over - rot over - -rot 1-
                   1031: EXIT THEN 1+ AGAIN ;
                   1032: : (prune) ( name len head -- )
                   1033: dup >r (find) ?dup IF r> BEGIN dup @ WHILE 2dup @ = IF
                   1034: >r @ r> ! EXIT THEN @ REPEAT 2drop ELSE r> drop THEN ;
                   1035: : prune ( name len -- )  last (prune) ;
                   1036: : set-property ( data dlen name nlen phandle -- )
                   1037: true to encode-first?
                   1038: get-current >r  node>properties @ set-current
                   1039: 2dup prune  $2CONSTANT  r> set-current ;
                   1040: : delete-property ( name nlen -- )
                   1041: get-node get-current >r  node>properties @ set-current
                   1042: prune r> set-current ;
                   1043: : property ( data dlen name nlen -- )  get-node set-property ;
                   1044: : get-property ( str len phandle -- true | data dlen false )
                   1045: ?dup 0= IF cr cr cr ." get-property for " type ."  on zero phandle"
                   1046: cr cr true EXIT THEN
                   1047: node>properties @ voc-find dup IF link> execute false ELSE drop true THEN ;
                   1048: : get-package-property ( str len phandle -- true | data dlen false )
                   1049: get-property ;
                   1050: : get-my-property ( str len -- true | data dlen false )
                   1051: my-self ihandle>phandle get-property ;
                   1052: : get-parent-property ( str len -- true | data dlen false )
                   1053: my-parent ihandle>phandle get-property ;
                   1054: : get-inherited-property ( str len -- true | data dlen false )
                   1055: my-self ihandle>phandle
1.1.1.3 ! root     1056: BEGIN
        !          1057: 3dup get-property 0= IF
1.1       root     1058: rot drop rot drop rot drop false EXIT
                   1059: THEN
1.1.1.3 ! root     1060: parent dup 0= IF
        !          1061: 3drop true EXIT
1.1       root     1062: THEN
1.1.1.3 ! root     1063: AGAIN
        !          1064: ;
1.1       root     1065: 20 CONSTANT indent-prop
                   1066: : .prop-int ( str len -- )
                   1067: space
                   1068: 400 min 0
                   1069: ?DO
                   1070: i over + dup                                 ( str act-addr act-addr )
                   1071: c@ 2 0.r 1+ dup c@ 2 0.r 1+ dup c@ 2 0.r 1+ c@ 2 0.r ( str )
                   1072: i c and c = IF                           \ check for multipleof 16 bytes
                   1073: cr indent @ indent-prop + 1+ 0        \ linefeed + indent
                   1074: DO
                   1075: space                              \ print spaces
                   1076: LOOP
                   1077: ELSE
                   1078: space space                           \ print two spaces
                   1079: THEN
                   1080: 4 +LOOP
                   1081: drop
                   1082: ;
                   1083: : .prop-bytes ( str len -- )
                   1084: 2dup -4 and .prop-int                       ( str len )
                   1085: dup 3 and dup IF                            ( str len len%4 )
                   1086: >r -4 and + r>                           ( str' len%4 )
                   1087: bounds                                   ( str' str'+len%4 )
                   1088: DO
                   1089: i c@ 2 0.r                            \ Print last 3 bytes
                   1090: LOOP
                   1091: ELSE
                   1092: 3drop
                   1093: THEN
                   1094: ;
                   1095: : .prop-string ( str len )
                   1096: 2dup space type
                   1097: cr indent @ indent-prop + 0 DO space LOOP   \ Linefeed
                   1098: .prop-bytes
                   1099: ;
                   1100: : .propbytes ( xt -- )
                   1101: execute dup
                   1102: IF
                   1103: over cell- @ execute
                   1104: ELSE
                   1105: 2drop
                   1106: THEN
                   1107: ;
                   1108: : .property ( lfa -- )
                   1109: cr indent @ 0
                   1110: ?DO
                   1111: space
                   1112: LOOP
                   1113: link> dup >name name>string 2dup type nip ( len )
                   1114: indent-prop swap -                        ( xt 20-len )
                   1115: dup 0< IF drop 0 THEN 0                   ( xt number-of-space 0 )
                   1116: ?DO
                   1117: space
                   1118: LOOP
                   1119: .propbytes
                   1120: ;
                   1121: : (.properties) ( phandle -- )
                   1122: node>properties @ cell+ @ BEGIN dup WHILE dup .property @ REPEAT drop ;
                   1123: : .properties ( -- )
                   1124: get-node (.properties) ;
                   1125: : next-property ( str len phandle -- false | str' len' true )
                   1126: ?dup 0= IF device-tree @ THEN  \ XXX: is this line required?
                   1127: node>properties @
                   1128: >r 2dup 0= swap 0= or IF 2drop r> cell+ ELSE r> voc-find THEN
                   1129: @ dup IF link>name name>string true THEN ;
                   1130: : encode-start ( -- prop 0 )
                   1131: ['] .prop-int compile,
                   1132: false to encode-first?
                   1133: here 0
                   1134: ;
                   1135: : encode-int ( val -- prop prop-len )
                   1136: encode-first? IF
                   1137: ['] .prop-int compile,             \ Execution token for print
                   1138: false to encode-first?
                   1139: THEN
                   1140: here swap lbsplit c, c, c, c, /l
                   1141: ;
                   1142: : encode-bytes ( str len -- prop-addr prop-len )
                   1143: encode-first? IF
                   1144: ['] .prop-bytes compile,           \ Execution token for print
                   1145: false to encode-first?
                   1146: THEN
                   1147: here over 2dup 2>r allot swap move 2r>
                   1148: ;
                   1149: : encode-string ( str len -- prop-addr prop-len )
                   1150: encode-first? IF
                   1151: ['] .prop-string compile,          \ Execution token for print
                   1152: false to encode-first?
                   1153: THEN
                   1154: encode-bytes 0 c, char+
                   1155: ;
                   1156: : encode+ ( prop1-addr prop1-len prop2-addr prop2-len -- prop-addr prop-len )
                   1157: nip + ;
                   1158: : encode-int+  encode-int encode+ ;
                   1159: : encode-64    xlsplit encode-int rot encode-int+ ;
                   1160: : encode-64+   encode-64 encode+ ;
                   1161: : device-name  encode-string s" name"        property ;
                   1162: : device-type  encode-string s" device_type" property ;
                   1163: : model        encode-string s" model"       property ;
                   1164: : compatible   encode-string s" compatible"  property ;
                   1165: : #address-cells  s" #address-cells" rot parent get-property
                   1166: ABORT" parent doesn't have a #address-cells property!"
                   1167: decode-int nip nip
                   1168: ;
                   1169: : my-#address-cells  ( -- #address-cells )
                   1170: get-node #address-cells
                   1171: ;
                   1172: : child-#address-cells  ( -- #address-cells )
                   1173: s" #address-cells" get-node get-property
                   1174: ABORT" node doesn't have a #address-cells property!"
                   1175: decode-int nip nip
                   1176: ;
                   1177: : child-#size-cells  ( -- #address-cells )
                   1178: s" #size-cells" get-node get-property
                   1179: ABORT" node doesn't have a #size-cells property!"
                   1180: decode-int nip nip
                   1181: ;
                   1182: : encode-phys  ( phys.hi ... phys.low -- prop len )
                   1183: encode-first?  IF  encode-start  ELSE  here 0  THEN
                   1184: my-#address-cells 0 ?DO rot encode-int+ LOOP
                   1185: ;
                   1186: : encode-child-phys  ( phys.hi ... phys.low -- prop len )
                   1187: encode-first?  IF  encode-start  ELSE  here 0  THEN
                   1188: child-#address-cells 0 ?DO rot encode-int+ LOOP
                   1189: ;
                   1190: : encode-child-size  ( size.hi ... size.low -- prop len )
                   1191: encode-first? IF  encode-start  ELSE  here 0  THEN
                   1192: child-#size-cells 0 ?DO rot encode-int+ LOOP
                   1193: ;
                   1194: : decode-phys
                   1195: my-#address-cells BEGIN dup WHILE 1- >r decode-int r> swap >r REPEAT drop
                   1196: my-#address-cells BEGIN dup WHILE 1- r> swap REPEAT drop ;
                   1197: : decode-phys-and-drop
                   1198: my-#address-cells BEGIN dup WHILE 1- >r decode-int r> swap >r REPEAT 3drop
                   1199: my-#address-cells BEGIN dup WHILE 1- r> swap REPEAT drop ;
                   1200: : reg  >r encode-phys r> encode-int+ s" reg" property ;
                   1201: : >space    node>space @ ;
                   1202: : >space?   node>space? @ ;
                   1203: : >address  dup >r #address-cells dup 3 > IF r@ node>addr3 @ swap THEN
                   1204: dup 2 > IF r@ node>addr2 @ swap THEN
                   1205: 1 > IF r@ node>addr1 @ THEN r> drop ;
                   1206: : >unit     dup >r >address r> >space ;
1.1.1.2   root     1207: : (my-phandle)  ( -- phandle )
                   1208: my-self ?dup IF
                   1209: ihandle>phandle
                   1210: ELSE
                   1211: get-node dup 0= ABORT" no active node"
                   1212: THEN
                   1213: ;
1.1       root     1214: : my-space ( -- phys.hi )
1.1.1.2   root     1215: (my-phandle) >space
                   1216: ;
                   1217: : my-address  (my-phandle) >address ;
1.1.1.3 ! root     1218: : my-unit
        !          1219: my-self instance>#units @ IF
        !          1220: 0 my-self instance>#units @ 1- DO
        !          1221: my-self instance>unit1 i cells + @
        !          1222: -1 +LOOP
        !          1223: ELSE
        !          1224: my-self ihandle>phandle >unit
        !          1225: THEN
        !          1226: ;
1.1       root     1227: : my-unit-64 ( -- phys.lo+1|phys.lo )
                   1228: my-unit                                ( phys.lo ... phys.hi )
1.1.1.2   root     1229: (my-phandle) #address-cells            ( phys.lo ... phys.hi #ad-cells )
1.1       root     1230: CASE
                   1231: 1   OF EXIT ENDOF
                   1232: 2   OF lxjoin EXIT ENDOF
                   1233: 3   OF drop lxjoin EXIT ENDOF
                   1234: dup OF 2drop lxjoin EXIT ENDOF
                   1235: ENDCASE
                   1236: ;
                   1237: : set-space    get-node dup >r node>space ! true r> node>space? ! ;
                   1238: : set-address  my-#address-cells 1 ?DO
                   1239: get-node node>space i cells + ! LOOP ;
                   1240: : set-unit     set-space set-address ;
                   1241: : set-unit-64 ( phys.lo|phys.hi -- )
                   1242: my-#address-cells 2 <> IF
                   1243: ." set-unit-64: #address-cells <> 2 " abort
                   1244: THEN
                   1245: xlsplit set-unit
                   1246: ;
                   1247: : set-args ( arg-str len unit-str len -- )
1.1.1.3 ! root     1248: s" decode-unit" get-parent $call-static set-unit set-my-args
        !          1249: ;
        !          1250: : $cat-unit
        !          1251: dup parent 0= IF drop EXIT THEN
1.1       root     1252: dup >space? not IF drop EXIT THEN
1.1.1.3 ! root     1253: dup >r >unit s" encode-unit" r> parent $call-static
        !          1254: dup IF
1.1       root     1255: dup >r here swap move s" @" $cat here r> $cat
1.1.1.3 ! root     1256: ELSE
        !          1257: 2drop
        !          1258: THEN
        !          1259: ;
1.1       root     1260: : node>name  dup >r s" name" rot get-property IF r> (u.) ELSE 1- r> drop THEN ;
                   1261: : node>qname dup node>name rot ['] $cat-unit CATCH IF drop THEN ;
1.1.1.3 ! root     1262: : node>path
        !          1263: here 0 rot
        !          1264: BEGIN dup WHILE dup parent REPEAT
        !          1265: 2drop
1.1       root     1266: dup 0= IF [char] / c, THEN
1.1.1.3 ! root     1267: BEGIN
        !          1268: dup
        !          1269: WHILE
        !          1270: [char] / c, node>qname here over allot swap move
        !          1271: REPEAT
        !          1272: drop here 2dup - allot over -
        !          1273: ;
1.1       root     1274: : interposed? ( ihandle -- flag )
                   1275: dup instance>parent @ dup 0= IF 2drop false EXIT THEN
                   1276: ihandle>phandle swap ihandle>phandle parent <> ;
                   1277: : instance>qname  dup >r interposed? IF s" %" ELSE 0 0 THEN
                   1278: r@ ihandle>phandle node>qname $cat  r> instance>args 2@
                   1279: dup IF 2>r s" :" $cat 2r> $cat ELSE 2drop THEN ;
                   1280: : instance>qpath \ With interposed nodes.
                   1281: here 0 rot BEGIN dup WHILE dup instance>parent @ REPEAT 2drop
                   1282: dup 0= IF [char] / c, THEN
                   1283: BEGIN dup WHILE [char] / c, instance>qname here over allot swap move
                   1284: REPEAT drop here 2dup - allot over - ;
                   1285: : instance>path \ Without interposed nodes.
                   1286: here 0 rot BEGIN dup WHILE
                   1287: dup interposed? 0= IF dup THEN instance>parent @ REPEAT 2drop
                   1288: dup 0= IF [char] / c, THEN
                   1289: BEGIN dup WHILE [char] / c, instance>qname here over allot swap move
                   1290: REPEAT drop here 2dup - allot over - ;
                   1291: : .node  node>path type ;
                   1292: : pwd  get-node .node ;
                   1293: : .instance instance>qpath type ;
                   1294: : .chain    dup instance>parent @ ?dup IF recurse THEN
                   1295: cr dup . instance>qname type ;
                   1296: defer find-node
                   1297: : set-alias ( alias-name len device-name len -- )
                   1298: encode-string
                   1299: 2swap s" /aliases" find-node ?dup IF
                   1300: set-property
                   1301: ELSE
                   1302: 4drop
                   1303: THEN
                   1304: ;
                   1305: : find-alias ( alias-name len -- false | dev-path len )
                   1306: s" /aliases" find-node dup IF
                   1307: get-property 0= IF 1- dup 0= IF nip THEN ELSE false THEN
1.1.1.3 ! root     1308: THEN
        !          1309: ;
1.1       root     1310: : .alias ( alias-name len -- )
                   1311: find-alias dup IF type ELSE ." no alias available" THEN ;
                   1312: : (.print-alias) ( lfa -- )
                   1313: link> dup >name name>string
                   1314: 2dup s" name" string=ci IF 2drop drop
                   1315: ELSE cr type space ." : " execute type
                   1316: THEN ;
                   1317: : (.list-alias) ( phandle -- )
                   1318: node>properties @ cell+ @ BEGIN dup WHILE dup (.print-alias) @ REPEAT drop ;
                   1319: : list-alias ( -- )
                   1320: s" /aliases" find-node dup IF (.list-alias) THEN ;
                   1321: : devalias ( "{alias-name}<>{device-specifier}<cr>" -- )
                   1322: parse-word parse-word dup IF set-alias
                   1323: ELSE 2drop dup IF .alias
                   1324: ELSE 2drop list-alias THEN THEN ;
                   1325: : sub-alias ( arg-str arg-len -- arg' len' | false )
                   1326: 2dup
                   1327: 2dup [char] / findchar ?dup IF ELSE 2dup [char] : findchar THEN
                   1328: ( a l a l [p] -1|0 ) IF nip dup ELSE 2drop 0 THEN >r
                   1329: find-alias ?dup IF ( a l a' p' -- R:p | a' l' -- R:0 )
1.1.1.3 ! root     1330: r@ IF
        !          1331: 2swap r@ - swap r> + swap $cat strdup ( a" l-p+p' -- )
        !          1332: ELSE
        !          1333: ( a' l' -- R:0 ) r> drop ( a' l' -- )
        !          1334: THEN
        !          1335: ELSE
        !          1336: ( a l -- R:p | -- R:0 ) r> IF 2drop THEN
        !          1337: false ( 0 -- )
        !          1338: THEN
1.1       root     1339: ;
                   1340: : de-alias ( arg-str arg-len -- arg' len' )
1.1.1.3 ! root     1341: BEGIN
        !          1342: over c@ [char] / <> dup IF drop 2dup sub-alias ?dup THEN
        !          1343: WHILE
        !          1344: 2swap 2drop
        !          1345: REPEAT
1.1       root     1346: ;
                   1347: : +indent ( not-last? -- )
                   1348: IF s" |   " ELSE s"     " THEN $indent indent @ + swap move 4 indent +! ;
                   1349: : -indent ( -- )  -4 indent +! ;
1.1.1.3 ! root     1350: : ls-phandle ( node -- )  . ." :  " ;
1.1       root     1351: : ls-node ( node -- )
1.1.1.3 ! root     1352: cr dup ls-phandle
        !          1353: $indent indent @ type
        !          1354: dup peer IF ." |-- " ELSE ." +-- " THEN
        !          1355: node>qname type
        !          1356: ;
1.1       root     1357: : (ls) ( node -- )
                   1358: child BEGIN dup WHILE dup ls-node dup child IF
                   1359: dup peer +indent dup recurse -indent THEN peer REPEAT drop ;
1.1.1.3 ! root     1360: : ls ( -- )
        !          1361: get-node cr
        !          1362: dup ls-phandle
        !          1363: dup node>path type
        !          1364: (ls)
        !          1365: 0 indent !
        !          1366: ;
1.1       root     1367: : show-devs ( {device-specifier}<eol> -- )
                   1368: skipws 0 parse dup IF de-alias ELSE 2drop s" /" THEN   ( str len )
                   1369: find-node dup 0= ABORT" No such device path" (ls)
                   1370: ;
                   1371: VARIABLE interpose-node
                   1372: 2VARIABLE interpose-args
                   1373: : interpose ( arg len phandle -- )  interpose-node ! interpose-args 2! ;
1.1.1.3 ! root     1374: 0 VALUE user-instance-#units
        !          1375: CREATE user-instance-units 4 cells allot
        !          1376: : copy-instance-unit  ( -- )
        !          1377: user-instance-#units IF
        !          1378: user-instance-#units my-self instance>#units !
        !          1379: user-instance-units my-self instance>unit1 user-instance-#units cells move
        !          1380: 0 to user-instance-#units
        !          1381: THEN
        !          1382: ;
        !          1383: : open-node ( arg len phandle -- ihandle|0 )
        !          1384: current-node @ >r  my-self >r            \ Save current node and instance
        !          1385: set-node create-instance set-my-args
        !          1386: copy-instance-unit
        !          1387: s" open" get-node find-method IF execute ELSE TRUE THEN
        !          1388: 0= IF
        !          1389: my-self destroy-instance 0 to my-self
        !          1390: THEN
        !          1391: my-self                                  ( ihandle|0 )
        !          1392: r> to my-self  r> set-node               \ Restore current node and instance
        !          1393: interpose-node @ IF
        !          1394: my-self >r to my-self
1.1       root     1395: interpose-args 2@ interpose-node @
1.1.1.3 ! root     1396: interpose-node off recurse
        !          1397: r> to my-self
        !          1398: THEN
        !          1399: ;
1.1       root     1400: : close-node ( ihandle -- )
                   1401: my-self >r to my-self
                   1402: s" close" ['] $call-my-method CATCH IF 2drop THEN
                   1403: my-self destroy-instance r> to my-self ;
                   1404: : close-dev ( ihandle -- )
                   1405: my-self >r to my-self
                   1406: BEGIN my-self WHILE my-parent my-self close-node to my-self REPEAT
                   1407: r> to my-self ;
                   1408: : new-device ( -- )
1.1.1.3 ! root     1409: my-self new-node                     ( parent-ihandle phandle )
        !          1410: node>instance-template @             ( parent-ihandle ihandle )
        !          1411: dup to my-self                       ( parent-ihanlde ihandle )
        !          1412: instance>parent !
        !          1413: get-node my-self instance>node !
        !          1414: max-instance-size my-self instance>size !
        !          1415: ;
1.1       root     1416: : finish-device ( -- )
1.1.1.3 ! root     1417: get-node >space? 0= IF
        !          1418: s" reg" get-node get-property 0= IF
        !          1419: decode-int set-space 2drop
        !          1420: THEN
        !          1421: THEN
        !          1422: finish-node my-parent to my-self
        !          1423: ;
        !          1424: : extend-device  ( phandle -- )
        !          1425: my-self >r
        !          1426: dup set-node
        !          1427: node>instance-template @
        !          1428: dup to my-self
        !          1429: r> swap instance>parent !
1.1.1.2   root     1430: ;
1.1       root     1431: : split ( str len char -- left len right len )
                   1432: >r 2dup r> findchar IF >r over r@ 2swap r> 1+ /string ELSE 0 0 THEN ;
                   1433: : generic-decode-unit ( str len ncells -- addr.lo ... addr.hi )
                   1434: dup >r -rot BEGIN r@ WHILE r> 1- >r [char] , split 2swap
                   1435: $number IF 0 THEN r> swap >r >r REPEAT r> 3drop
                   1436: BEGIN dup WHILE 1- r> swap REPEAT drop ;
                   1437: : generic-encode-unit ( addr.lo ... addr.hi ncells -- str len )
                   1438: 0 0 rot ?dup IF 0 ?DO rot (u.) $cat s" ," $cat LOOP 1- THEN ;
                   1439: : hex-decode-unit ( str len ncells -- addr.lo ... addr.hi )
                   1440: base @ >r hex generic-decode-unit r> base ! ;
                   1441: : hex-encode-unit ( addr.lo ... addr.hi ncells -- str len )
                   1442: base @ >r hex generic-encode-unit r> base ! ;
                   1443: : handle-leading-/ ( path len -- path' len' )
                   1444: dup IF over c@ [char] / = IF 1 /string device-tree @ set-node THEN THEN ;
                   1445: : match-name ( name len node -- match? )
                   1446: over 0= IF 3drop true EXIT THEN
                   1447: s" name" rot get-property IF 2drop false EXIT THEN
                   1448: 1- string=ci ; \ XXX should use decode-string
1.1.1.3 ! root     1449: 0 VALUE #search-unit
        !          1450: CREATE search-unit 4 cells allot
1.1       root     1451: : match-unit ( node -- match? )
                   1452: node>space search-unit #search-unit 0 ?DO 2dup @ swap @ <> IF
                   1453: 2drop false UNLOOP EXIT THEN cell+ swap cell+ swap LOOP 2drop true ;
                   1454: : match-node ( name len node -- match? )
                   1455: dup >r match-name r> match-unit and ; \ XXX e3d
                   1456: : find-kid ( name len -- node|0 )
                   1457: dup -1 = IF \ are we supposed to stay in the same node? -> resolve-relatives
                   1458: 2drop get-node
                   1459: ELSE
                   1460: get-node child >r BEGIN r@ WHILE 2dup r@ match-node
                   1461: IF 2drop r> EXIT THEN r> peer >r REPEAT
                   1462: r> 3drop false
                   1463: THEN ;
                   1464: : set-search-unit ( unit len -- )
1.1.1.3 ! root     1465: 0 to #search-unit
        !          1466: 0 to user-instance-#units
        !          1467: dup 0= IF 2drop EXIT THEN
1.1       root     1468: s" #address-cells" get-node get-property THROW
                   1469: decode-int to #search-unit 2drop
                   1470: s" decode-unit" get-node $call-static
1.1.1.3 ! root     1471: #search-unit 0 ?DO search-unit i cells + ! LOOP
        !          1472: ;
1.1       root     1473: : resolve-relatives ( path len -- path' len' )
                   1474: 2dup 2 = swap s" .." comp 0= and IF
                   1475: get-node parent ?dup IF
                   1476: set-node drop -1
                   1477: ELSE
                   1478: s" Already in root node." type
                   1479: THEN
                   1480: THEN
                   1481: 2dup 1 = swap c@ [CHAR] . = and IF
                   1482: drop -1
                   1483: THEN
                   1484: ;
1.1.1.3 ! root     1485: : set-instance-unit  ( unitaddr len -- )
        !          1486: dup 0= IF 2drop  0 to user-instance-#units  EXIT THEN
        !          1487: 2dup 0 -rot bounds ?DO
        !          1488: i c@ [char] , = IF 1+ THEN      \ Count the commas
        !          1489: LOOP
        !          1490: 1+ dup to user-instance-#units
        !          1491: hex-decode-unit
        !          1492: user-instance-#units 0 ?DO
        !          1493: user-instance-units i cells + !
        !          1494: LOOP
        !          1495: ;
        !          1496: : split-component  ( path. -- path'. args. name. unit. )
        !          1497: [char] / split 2swap     ( path'. component. )
        !          1498: [char] : split 2swap     ( path'. args. name@unit. )
        !          1499: [char] @ split           ( path'. args. name. unit. )
        !          1500: ;
        !          1501: : find-component  ( path len -- path' len' args len node|0 )
        !          1502: split-component           ( path'. args. name. unit. )
        !          1503: ['] set-search-unit CATCH IF
        !          1504: set-instance-unit
        !          1505: THEN
        !          1506: resolve-relatives find-kid        ( path' len' args len node|0 )
        !          1507: dup IF dup >space? user-instance-#units 0 > AND IF
        !          1508: cr ." find-component with unit mismatch!" .s cr
        !          1509: drop 0
        !          1510: THEN THEN
        !          1511: ;
1.1       root     1512: : .find-node ( path len -- phandle|0 )
                   1513: current-node @ >r
                   1514: handle-leading-/ current-node @ 0= IF 2drop r> set-node 0 EXIT THEN
                   1515: BEGIN dup WHILE \ handle one component:
                   1516: find-component ( path len args len node ) dup 0= IF
                   1517: 3drop 2drop r> set-node 0 EXIT THEN
                   1518: set-node 2drop REPEAT 2drop
                   1519: get-node r> set-node ;
                   1520: ' .find-node to find-node
                   1521: : find-node ( path len -- phandle|0 ) de-alias find-node ;
                   1522: : delete-node ( phandle -- )
1.1.1.3 ! root     1523: dup node>instance-template @ max-instance-size free-mem
1.1       root     1524: dup node>parent @ node>child @ ( phandle 1st peer )
                   1525: 2dup = IF
                   1526: node>peer @ swap node>parent @ node>child !
                   1527: EXIT
                   1528: THEN
                   1529: dup node>peer @
1.1.1.3 ! root     1530: BEGIN
        !          1531: 2 pick 2dup <>
        !          1532: WHILE
1.1       root     1533: drop
                   1534: nip dup node>peer @
                   1535: dup 0= IF 2drop drop unloop EXIT THEN
                   1536: REPEAT
                   1537: drop
1.1.1.3 ! root     1538: node>peer @  swap node>peer !
1.1       root     1539: drop
                   1540: ;
                   1541: : open-dev ( path len -- ihandle|0 )
1.1.1.3 ! root     1542: 0 to user-instance-#units
1.1       root     1543: de-alias current-node @ >r
                   1544: handle-leading-/ current-node @ 0= IF 2drop r> set-node 0 EXIT THEN
1.1.1.3 ! root     1545: my-self >r
        !          1546: 0 to my-self
        !          1547: 0 0 >r >r
        !          1548: BEGIN
        !          1549: dup
        !          1550: WHILE \ handle one component:
1.1       root     1551: ( arg len ) r> r> get-node open-node to my-self
                   1552: find-component ( path len args len node ) dup 0= IF
1.1.1.3 ! root     1553: 3drop 2drop my-self close-dev
        !          1554: r> to my-self
        !          1555: r> set-node
        !          1556: 0 EXIT
        !          1557: THEN
        !          1558: set-node
        !          1559: >r >r
        !          1560: REPEAT
        !          1561: 2drop
1.1       root     1562: r> r> get-node open-node to my-self
1.1.1.3 ! root     1563: my-self r> to my-self r> set-node
        !          1564: ;
1.1       root     1565: : select-dev  open-dev dup to my-self ihandle>phandle set-node ;
1.1.1.3 ! root     1566: : unselect-dev  my-self close-dev  0 to my-self  device-end ;
1.1       root     1567: : find-device ( str len -- ) \ set as active node
                   1568: find-node dup 0= ABORT" No such device path" set-node ;
1.1.1.3 ! root     1569: : dev  parse-word find-device ;
1.1       root     1570: : (lsprop) ( node --)
                   1571: dup cr $indent indent @ type ."     node: " node>qname type
1.1.1.3 ! root     1572: false +indent (.properties) cr -indent
        !          1573: ;
1.1       root     1574: : (show-children) ( node -- )
1.1.1.3 ! root     1575: child BEGIN
        !          1576: dup
        !          1577: WHILE
1.1       root     1578: dup (lsprop) dup child IF false +indent dup recurse -indent THEN peer
1.1.1.3 ! root     1579: REPEAT
        !          1580: drop
1.1       root     1581: ;
                   1582: : lsprop ( {device-specifier}<eol> -- )
                   1583: skipws 0 parse dup IF de-alias ELSE 2drop s" /" THEN
                   1584: find-device get-node dup dup
1.1.1.3 ! root     1585: cr ." node: " node>path type (.properties) cr (show-children)
        !          1586: 0 indent !
        !          1587: ;
1.1       root     1588: : (node>path) node>path ;
                   1589: : node>path ( phandle -- str len )
                   1590: node>path dup allot
                   1591: ;
                   1592: 0 VALUE packages
                   1593: : find-package  ( name len -- false | phandle true )
1.1.1.3 ! root     1594: dup 0 <= IF
        !          1595: 2drop FALSE EXIT
        !          1596: THEN
        !          1597: over c@ [char] / = IF
        !          1598: find-node dup IF TRUE THEN EXIT
        !          1599: THEN
        !          1600: 0 >r packages child
        !          1601: BEGIN
        !          1602: dup
        !          1603: WHILE
        !          1604: dup >r node>name 2over string=ci r> swap IF
        !          1605: r> drop dup >r
        !          1606: THEN
        !          1607: peer
        !          1608: REPEAT
        !          1609: 3drop
        !          1610: r> dup IF true THEN
        !          1611: ;
1.1       root     1612: : open-package ( arg len phandle -- ihandle | 0 )  open-node ;
                   1613: : close-package ( ihandle -- )  close-node ;
                   1614: : $open-package ( arg len name len -- ihandle | 0 )
                   1615: find-package IF open-package ELSE 2drop false THEN ;
                   1616: : pci-address-type  ( node address prop_type -- type )
                   1617: -rot 2 pick ( prop_type node address prop_type )
                   1618: 0= IF
                   1619: swap s" reg" rot get-property  ( prop_type address data dlen false )
                   1620: ELSE
                   1621: swap s" assigned-addresses" rot get-property  ( prop_type address data dlen false )
                   1622: THEN
                   1623: IF  2drop -1  EXIT  THEN  4 / 5 /
                   1624: 0 DO
                   1625: dup l@ FF AND 0<> ( prop_type address data cfgspace_offset? )
                   1626: 3 pick 0= ( prop_type address data cfgspace_offset? reg_prop? )
                   1627: AND NOT IF 
                   1628: 2dup 8 + ( prop_type address data address data' )
                   1629: 2dup l@ 2 pick 8 + l@ + <= -rot l@  >= and  IF
                   1630: l@ 03000000 and 18 rshift nip
                   1631: dup 3 = IF  1-  THEN
                   1632: swap drop ( type )
                   1633: UNLOOP EXIT
                   1634: THEN
                   1635: THEN
                   1636: 4 5 * +
                   1637: LOOP
                   1638: 3drop -1
                   1639: ;
                   1640: : (range-read-cells)  ( range-addr #cells -- range-value )
                   1641: 1 =  IF  l@  ELSE  @  THEN
                   1642: ;
                   1643: : (map-one-range)  ( type range pnac nsc nac address -- address true | address false )
                   1644: over 3 = 5 pick l@ 3000000 and 18 rshift 7 pick <> and  IF
                   1645: >r 2drop 3drop r> false EXIT
                   1646: THEN
                   1647: 4 pick 4 pick 3 pick + 4 * +
                   1648: 3 pick
                   1649: (range-read-cells)
                   1650: 5 pick 3 pick 3 =  IF
                   1651: 4 +
                   1652: THEN
                   1653: 3 pick
                   1654: (range-read-cells)
                   1655: dup >r dup 3 pick > >r + over <= r> or  IF
                   1656: >r 2drop 3drop r> r> drop false EXIT
                   1657: THEN
                   1658: dup r> -
                   1659: 5 pick 5 pick 3 =  IF
                   1660: 4 +
                   1661: THEN
                   1662: 3 pick 4 * +
                   1663: 5 pick
                   1664: (range-read-cells)
                   1665: + >r 3drop 3drop r> true
                   1666: ;
                   1667: : translate-address  ( node address -- address )
                   1668: 2dup 1 pci-address-type  ( node address type )
                   1669: dup -1 = IF
                   1670: drop 2dup 0 pci-address-type ( node address type )
                   1671: THEN
                   1672: rot parent BEGIN
                   1673: dup parent 0=  IF  2drop EXIT  THEN
                   1674: s" #address-cells" 2 pick get-property 2drop l@ >r        \ nac
                   1675: s" #size-cells" 2 pick get-property 2drop l@ >r           \ nsc
                   1676: s" #address-cells" 2 pick parent get-property 2drop l@ >r \ pnac
                   1677: -rot ( node address type )
                   1678: s" ranges" 4 pick get-property  IF
                   1679: 3drop
                   1680: ABORT" no ranges property; not translatable"
                   1681: THEN
                   1682: r> r> r> 3 roll
                   1683: 4 / >r 3dup + + >r 5 roll r> r> swap / 0 ?DO
                   1684: 6dup (map-one-range) IF
                   1685: nip leave
                   1686: THEN
                   1687: nip
                   1688: 4 roll
                   1689: 4 pick 4 pick 4 pick + + 4 * + 4 -roll
                   1690: LOOP
                   1691: >r 2drop 2drop r> ( node type address )
                   1692: swap rot parent ( address type node )
                   1693: dup 0=
                   1694: UNTIL
                   1695: ;
                   1696: : translate-my-address  ( address -- address' )
                   1697: get-node swap translate-address
                   1698: ;
                   1699: : find-substr ( basestr-ptr basestr-len substr-ptr substr-len -- pos )
                   1700: dup 0 = IF
                   1701: 2drop 2drop 0 exit THEN
                   1702: dup 3 pick <= IF
                   1703: 2 pick over - 1+ 0 DO dup 0 DO
                   1704: over i + c@ 4 pick j + i + c@ = IF
                   1705: dup i 1+ = IF
                   1706: 2drop 2drop j unloop unloop exit THEN
                   1707: ELSE leave THEN
                   1708: LOOP LOOP
                   1709: THEN
                   1710: 2drop nip
                   1711: ;
                   1712: : find-isubstr ( basestr-ptr basestr-len substr-ptr substr-len -- pos )
                   1713: dup 0 = IF
                   1714: 2drop 2drop 0 exit THEN
                   1715: dup 3 pick <= IF
                   1716: 2 pick over - 1+ 0 DO dup 0 DO
                   1717: over i + c@ lcc 4 pick j + i + c@ lcc = IF
                   1718: dup i 1+ = IF
                   1719: 2drop 2drop j unloop unloop exit THEN
                   1720: ELSE leave THEN
                   1721: LOOP LOOP
                   1722: THEN
                   1723: 2drop nip
                   1724: ;
                   1725: : find-nextline ( str-ptr str-len -- pos )
                   1726: dup 0 ?DO over i + c@ CASE
                   1727: 0a OF
                   1728: dup 1- i = IF
                   1729: 2drop i 1+ unloop exit THEN
                   1730: over i 1+ + c@ 0d = IF
                   1731: 2drop i 2+ ELSE
                   1732: 2drop i 1+ THEN
                   1733: unloop exit
                   1734: ENDOF
                   1735: 0d OF
                   1736: dup 1- i = IF
                   1737: 2drop i 1+ unloop exit THEN
                   1738: over i 1+ + c@ 0a = IF
                   1739: 2drop i 2+ ELSE
                   1740: 2drop i 1+ THEN
                   1741: unloop exit
                   1742: ENDOF
                   1743: ENDCASE LOOP nip
                   1744: ;
                   1745: : string-at ( str1-ptr str1-len pos -- str2-ptr str2-len )
                   1746: -rot 2 pick - -rot swap chars + swap
                   1747: ;
                   1748: : string-cat ( addr1 len1 addr2 len2 -- addr1 len1+len2 )
                   1749: rot dup >r over + -rot
                   1750: 3 pick r> chars + -rot
                   1751: 0 ?DO
                   1752: 2dup c@ swap c!
                   1753: char+ swap char+ swap
                   1754: LOOP 2drop
                   1755: ;
                   1756: : char-cat ( addr len character -- addr len+1 )
                   1757: -rot 2dup >r >r 1+ rot r> r> chars + c!
                   1758: ;
                   1759: : overlap ( src dest size -- true|false )
                   1760: 3dup over + within IF 3drop true ELSE rot tuck + within THEN
                   1761: ;
                   1762: : parse-2int ( str len -- val.lo val.hi )
                   1763: [char] , split ?dup IF eval ELSE drop 0 THEN
                   1764: -rot ?dup IF eval ELSE drop 0 THEN
                   1765: ;
                   1766: : cpeek ( addr -- false | byte true ) c@ true ;
                   1767: : cpoke ( byte addr -- success? ) c! true ;
                   1768: : wpeek ( addr -- false | word true ) w@ true ;
                   1769: : wpoke ( word addr -- success? ) w! true ;
                   1770: : lpeek ( addr -- false | lword true ) l@ true ;
                   1771: : lpoke ( lword addr -- success? ) l! true ;
                   1772: defer reboot ( -- )
                   1773: defer halt ( -- )
                   1774: defer disable-watchdog ( -- )
                   1775: defer reset-watchdog ( -- )
                   1776: defer set-watchdog ( +n -- )
                   1777: defer set-led ( type instance state -- status )
                   1778: defer get-flashside ( -- side )
                   1779: defer set-flashside ( side -- status )
                   1780: defer read-bootlist ( -- )
                   1781: defer furnish-boot-file ( -- adr len )
                   1782: defer set-boot-file ( adr len -- )
                   1783: defer mfg-mode? ( -- flag )
                   1784: defer of-prompt? ( -- flag )
                   1785: defer debug-boot? ( -- flag )
                   1786: defer bmc-version ( -- adr len )
                   1787: defer cursor-on ( -- )
                   1788: defer cursor-off ( -- )
                   1789: : nop-reboot ( -- ) ." reboot not available" abort ;
                   1790: : nop-halt ( -- ) ." halt not available" abort ;
                   1791: : nop-disable-watchdog ( -- )  ;
                   1792: : nop-reset-watchdog ( -- )  ;
                   1793: : nop-set-watchdog ( +n -- ) drop ;
                   1794: : nop-set-led ( type instance state -- status ) drop drop drop ;
                   1795: : nop-get-flashside ( -- side ) ." Cannot get flashside" cr ABORT ;
                   1796: : nop-set-flashside ( side -- status ) ." Cannot set flashside" cr ABORT ;
                   1797: : nop-read-bootlist ( -- ) ;
                   1798: : nop-furnish-bootfile ( -- adr len ) s" net:" ;
                   1799: : nop-set-boot-file ( adr len -- ) 2drop ;
                   1800: : nop-mfg-mode? ( -- flag ) false ;
                   1801: : nop-of-prompt? ( -- flag ) false ;
                   1802: : nop-debug-boot? ( -- flag ) false ;
                   1803: : nop-bmc-version ( -- adr len ) s" XXXXX" ;
                   1804: : nop-cursor-on ( -- ) ;
                   1805: : nop-cursor-off ( -- ) ;
                   1806: ' nop-reboot to reboot
                   1807: ' nop-halt to halt
                   1808: ' nop-disable-watchdog to disable-watchdog
                   1809: ' nop-reset-watchdog   to reset-watchdog
                   1810: ' nop-set-watchdog     to set-watchdog
                   1811: ' nop-set-led          to set-led
                   1812: ' nop-get-flashside    to get-flashside
                   1813: ' nop-set-flashside    to set-flashside
                   1814: ' nop-read-bootlist    to read-bootlist
                   1815: ' nop-furnish-bootfile to furnish-boot-file
                   1816: ' nop-set-boot-file    to set-boot-file
                   1817: ' nop-mfg-mode?        to mfg-mode?
                   1818: ' nop-of-prompt?       to of-prompt?
                   1819: ' nop-debug-boot?      to debug-boot?
                   1820: ' nop-bmc-version      to bmc-version
                   1821: ' nop-cursor-on        to cursor-on
                   1822: ' nop-cursor-off       to cursor-off
                   1823: : reset-all reboot ;
                   1824: 10000000 value load-base
                   1825: 2000000 value flash-load-base
                   1826: : xt>name ( xt -- str len )
                   1827: BEGIN
                   1828: cell - dup c@ 0 2 within IF
                   1829: dup 2+ swap 1+ c@ exit
                   1830: THEN
                   1831: AGAIN
                   1832: ;
                   1833: cell -1 * CONSTANT -cell
                   1834: : cell- ( n -- n-cell-size )
                   1835: [ cell -1 * ] LITERAL +
                   1836: ;
                   1837: : find-xt-addr ( addr -- xt )
                   1838: BEGIN
                   1839: dup @ <colon> = IF
                   1840: EXIT
                   1841: THEN
                   1842: cell-
                   1843: AGAIN
                   1844: ;
                   1845: : (.immediate) ( xt -- )
                   1846: xt>name drop 2 - c@ \ skip len and flags
                   1847: immediate? IF
                   1848: ."  IMMEDIATE"
                   1849: THEN
                   1850: ;
                   1851: : (.xt) ( xt -- )
                   1852: xt>name type
                   1853: ;
                   1854: : trace-back (  )
                   1855: 1
                   1856: BEGIN
                   1857: cr dup dup . ."  : " rpick dup . ."  : "
                   1858: ['] tib here within IF
                   1859: dup rpick find-xt-addr (.xt)
                   1860: THEN
                   1861: 1+ dup rdepth 5 - >= IF cr drop EXIT THEN
                   1862: AGAIN
                   1863: ;
                   1864: VARIABLE see-my-type-column
                   1865: : (see-my-type) ( indent limit xt str len -- indent limit xt )
                   1866: dup see-my-type-column @ + dup 50 >= IF
                   1867: -rot over "  " comp 0= IF
                   1868: 2drop see-my-type-column !
                   1869: ELSE
1.1.1.3 ! root     1870: rot drop                     ( indent limit xt str len )
        !          1871: pocket swap 2dup >r >r       ( indent limit xt str pk len  R: len pk )
        !          1872: move r> r>                   ( indent limit xt pk len )
        !          1873: 2 pick (u.) dup -rot
        !          1874: cr type                      ( indent limit xt pk len xt-len )
        !          1875: " :" type 1+                 ( indent limit xt pk len prefix-len )
        !          1876: 5 pick dup spaces +          ( indent limit xt pk len prefix-len )
        !          1877: over + see-my-type-column !  ( indent limit xt pk len )
1.1       root     1878: type
1.1.1.3 ! root     1879: THEN                            ( indent limit xt )
1.1       root     1880: ELSE
1.1.1.3 ! root     1881: see-my-type-column ! type       ( indent limit xt )
1.1       root     1882: THEN
                   1883: ;
                   1884: : (see-my-type-init) ( -- )
                   1885: ffff see-my-type-column !        \ just enforce a new line
                   1886: ;
                   1887: : (see-colon-body) ( indent limit xt -- indent limit xt )
                   1888: (see-my-type-init)                              \ enforce new line
                   1889: BEGIN                                           ( indent limit xt )
                   1890: cell+ 2dup <>
                   1891: over @
                   1892: dup <semicolon> <>
                   1893: rot and                                           ( indent limit xt @xt flag )
                   1894: WHILE                                           ( indent limit xt @xt )
                   1895: xt>name (see-my-type) "  " (see-my-type)
                   1896: dup @                                        ( indent limit xt @xt)
                   1897: CASE
                   1898: <0branch>  OF cell+ dup @
                   1899: over + cell+ dup >r
                   1900: (u.) (see-my-type) r>          ( indent limit xt target)
                   1901: 2dup < IF
                   1902: over 4 pick 3 + -rot recurse
                   1903: nip nip nip cell-           ( indent limit xt )
                   1904: ELSE
                   1905: drop                        ( indent limit xt )
                   1906: THEN
                   1907: (see-my-type-init) ENDOF       \ enforce new line
                   1908: <branch>   OF cell+ dup @ over + cell+ (u.)
                   1909: (see-my-type) "  " (see-my-type) ENDOF
                   1910: <do?do>    OF cell+ dup @ (u.) (see-my-type)
                   1911: "  " (see-my-type) ENDOF
                   1912: <lit>      OF cell+ dup @ (u.) (see-my-type)
                   1913: "  " (see-my-type) ENDOF
                   1914: <dotick>   OF cell+ dup @ xt>name (see-my-type)
                   1915: "  " (see-my-type) ENDOF
                   1916: <doloop>   OF cell+ dup @ (u.) (see-my-type)
                   1917: "  " (see-my-type) ENDOF
1.1.1.3 ! root     1918: <do+loop>  OF cell+ dup @ (u.) (see-my-type)
        !          1919: "  " (see-my-type) ENDOF
1.1       root     1920: <doleave>  OF cell+ dup @ over + cell+ (u.)
                   1921: (see-my-type) "  " (see-my-type) ENDOF
                   1922: <do?leave> OF cell+ dup @ over + cell+ (u.)
                   1923: (see-my-type) "  " (see-my-type) ENDOF
                   1924: <sliteral> OF cell+ " """ (see-my-type) dup count dup >r
                   1925: (see-my-type) " """ (see-my-type)
                   1926: "  " (see-my-type)
                   1927: r> -cell and + ENDOF
                   1928: ENDCASE
                   1929: REPEAT
                   1930: drop
                   1931: ;
                   1932: : (see-colon) ( xt -- )
                   1933: (see-my-type-init)
                   1934: 1 swap 0 swap                                    ( indent limit xt )
                   1935: " : " (see-my-type) dup xt>name (see-my-type)
                   1936: rot drop 4 -rot (see-colon-body)                 ( indent limit xt )
                   1937: rot drop 1 -rot (see-my-type-init) " ;" (see-my-type)
                   1938: 3drop 
                   1939: ;
                   1940: : (see-create) ( xt -- )
                   1941: dup cell+ @
                   1942: CASE
                   1943: <2constant> OF
                   1944: dup cell+ cell+ dup @ swap cell+ @ . .  ." 2CONSTANT "
                   1945: ENDOF
                   1946: <instancevalue> OF
                   1947: dup cell+ cell+ @ . ." INSTANCE VALUE "
                   1948: ENDOF
                   1949: <instancevariable> OF
                   1950: ." INSTANCE VARIABLE "
                   1951: ENDOF
                   1952: dup OF
                   1953: ." CREATE "
                   1954: ENDOF
                   1955: ENDCASE
                   1956: (.xt)
                   1957: ;
                   1958: : (see) ( xt -- )
                   1959: cr dup dup @
                   1960: CASE
                   1961: <variable> OF ." VARIABLE " (.xt) ENDOF
                   1962: <value>    OF dup execute . ." VALUE " (.xt) ENDOF
                   1963: <constant> OF dup execute . ." CONSTANT " (.xt) ENDOF
                   1964: <defer>    OF dup cell+ @ swap ." DEFER " (.xt) ."  is " (.xt) ENDOF
                   1965: <alias>    OF dup cell+ @ swap ." ALIAS " (.xt) ."  " (.xt) ENDOF
                   1966: <buffer:>  OF ." BUFFER: " (.xt) ENDOF
                   1967: <create>   OF (see-create) ENDOF
                   1968: <colon>    OF (see-colon)  ENDOF
                   1969: dup        OF ." ??? PRIM " (.xt) ENDOF
                   1970: ENDCASE
                   1971: (.immediate) cr
                   1972: ;
                   1973: : see ( "old-name<>" -- )
                   1974: ' (see)
                   1975: ;
                   1976: 0    value forth-ip
                   1977: true value trace>stepping?
                   1978: true value trace>print?
                   1979: true value trace>up?
                   1980: 0    value trace>depth
                   1981: 0    value trace>rdepth
                   1982: 0    value trace>recurse
                   1983: : trace-depth+ ( -- ) trace>depth 1+ to trace>depth ;
                   1984: : trace-depth- ( -- ) trace>depth 1- to trace>depth ;
                   1985: : stepping ( -- )
                   1986: true to trace>stepping?
                   1987: ;
                   1988: : tracing ( -- )
                   1989: false to trace>stepping?
                   1990: ;
                   1991: : trace-print-on ( -- )
                   1992: true to trace>print?
                   1993: ;
                   1994: : trace-print-off ( -- )
                   1995: false to trace>print?
                   1996: ;
                   1997: : fip-add ( n -- )
                   1998: forth-ip + to forth-ip
                   1999: ;
                   2000: 0 value debug-last-xt
                   2001: 0 value debug-last-xt-content
                   2002: : trace-print ( -- )
                   2003: forth-ip cr u. ." : "
                   2004: forth-ip @ 
                   2005: dup ['] breakpoint = IF drop debug-last-xt-content THEN
                   2006: xt>name type ."  "
                   2007: ."     ( " .s  ."  )  | "
                   2008: ;
                   2009: : trace-interpret ( -- )
                   2010: rdepth 1- to trace>rdepth
                   2011: BEGIN
                   2012: depth . [char] > dup emit emit space
                   2013: source expect                        ( str len )
                   2014: ['] interpret catch print-status
                   2015: AGAIN
                   2016: ;
                   2017: : trace-xt ( xt -- )
                   2018: trace>recurse IF
                   2019: r> drop                                \ Drop return of 'trace-xt call
                   2020: cell+                                  \ Step over ":"
                   2021: ELSE
                   2022: debug-last-xt-content <colon> = IF
                   2023: ['] breakpoint @ debug-last-xt !    \ Re-arm break point
                   2024: r> drop                             \ Drop return of 'trace-xt call
                   2025: cell+                               \ Step over ":"
                   2026: ELSE
                   2027: ['] breakpoint debug-last-xt !      \ Re-arm break point
                   2028: 2r> 2drop
                   2029: THEN
                   2030: THEN
                   2031: to forth-ip
                   2032: true to trace>print?
                   2033: BEGIN
                   2034: trace>print? IF trace-print THEN
                   2035: forth-ip                                              ( ip )
                   2036: trace>stepping? IF
                   2037: BEGIN
                   2038: key
                   2039: CASE
                   2040: [char] d OF dup @ @ <colon> = IF             \ recurse only into colon definitions
                   2041: trace-depth+
                   2042: 1 to trace>recurse
                   2043: dup >r @ recurse
                   2044: THEN true ENDOF
                   2045: [char] u OF trace>depth IF tracing trace-print-off true ELSE false THEN ENDOF
                   2046: [char] f OF drop cr trace-interpret ENDOF      \ quit trace and start interpreter FIXME rstack
                   2047: [char] c OF tracing true ENDOF
                   2048: [char] t OF trace-back false ENDOF
                   2049: [char] q OF drop cr quit ENDOF
                   2050: 20       OF true ENDOF
                   2051: dup      OF cr ." Press d:       Down into current word" cr
                   2052: ." Press u:       Up to caller" cr
                   2053: ." Press f:       Switch to forth interpreter, 'resume' will continue tracing" cr
                   2054: ." Press c:       Switch to tracing" cr
                   2055: ." Press <space>: Execute current word" cr
                   2056: ." Press q:       Abort execution, switch to interpreter" cr
                   2057: false ENDOF
                   2058: ENDCASE
                   2059: UNTIL
                   2060: THEN                                                 ( ip' )
                   2061: dup to forth-ip @                                      ( xt )
                   2062: dup ['] breakpoint = IF drop debug-last-xt-content THEN
                   2063: dup                                                    ( xt xt )
                   2064: CASE
                   2065: <sliteral>  OF drop forth-ip cell+ dup dup c@ + -cell and to forth-ip ENDOF
                   2066: <dotick>    OF drop forth-ip cell+ @ cell fip-add ENDOF
                   2067: <lit>       OF drop forth-ip cell+ @ cell fip-add ENDOF
                   2068: <doto>      OF drop forth-ip cell+ @ cell+ ! cell fip-add ENDOF
1.1.1.3 ! root     2069: <(doito)>   OF drop forth-ip cell+ @ cell+ cell+ @ >instance ! cell fip-add ENDOF
1.1       root     2070: <0branch>   OF drop IF
                   2071: cell fip-add
                   2072: ELSE
                   2073: forth-ip cell+ @ cell+ fip-add THEN
                   2074: ENDOF
                   2075: <do?do>     OF drop 2dup <> IF
                   2076: swap >r >r cell fip-add
                   2077: ELSE
                   2078: forth-ip cell+ @ cell+ fip-add 2drop THEN
                   2079: ENDOF
                   2080: <branch>    OF drop forth-ip cell+ @ cell+ fip-add ENDOF
                   2081: <doleave>   OF drop r> r> 2drop forth-ip cell+ @ cell+ fip-add ENDOF           
                   2082: <do?leave>  OF drop IF
                   2083: r> r> 2drop forth-ip cell+ @ cell+ fip-add
                   2084: ELSE
                   2085: cell fip-add
                   2086: THEN
                   2087: ENDOF          
                   2088: <doloop>    OF drop r> 1+ r> 2dup = IF
                   2089: 2drop cell fip-add
                   2090: ELSE >r >r
                   2091: forth-ip cell+ @ cell+ fip-add THEN
                   2092: ENDOF
                   2093: <do+loop>   OF drop r> + r> 2dup >= IF
                   2094: 2drop cell fip-add
                   2095: ELSE >r >r
                   2096: forth-ip cell+ @ cell+ fip-add THEN
                   2097: ENDOF
                   2098: <semicolon> OF trace>depth 0> IF
                   2099: trace-depth- 1 to trace>recurse
                   2100: stepping drop r> recurse
                   2101: ELSE
                   2102: drop exit THEN
                   2103: ENDOF
                   2104: <exit>      OF trace>depth 0> IF
                   2105: trace-depth- stepping drop r> recurse
                   2106: ELSE
                   2107: drop exit THEN
                   2108: ENDOF
                   2109: dup         OF execute ENDOF
                   2110: ENDCASE
                   2111: forth-ip cell+ to forth-ip
                   2112: AGAIN
                   2113: ;
                   2114: : resume ( -- )
                   2115: trace>rdepth rdepth!
                   2116: forth-ip cell - trace-xt
                   2117: ;
                   2118: : debug-off ( -- )
                   2119: debug-last-xt IF
                   2120: debug-last-xt-content debug-last-xt !  \ Restore overwriten token
                   2121: 0 to debug-last-xt
                   2122: THEN
                   2123: ;
                   2124: : (break-entry) ( -- )
                   2125: debug-last-xt dup @ ['] breakpoint <> swap  ( debug-addr? debug-last-xt )
                   2126: debug-last-xt-content swap !                \ Restore overwriten token
                   2127: r> drop                                     \ Don't return to bp, but to caller
                   2128: debug-last-xt-content <colon> <> and IF     \ Execute non colon definition
                   2129: debug-last-xt cr u. ." : "
                   2130: debug-last-xt xt>name type ."  "
                   2131: ."     ( " .s  ."  )  | "
                   2132: key drop
                   2133: debug-last-xt execute
                   2134: ELSE
                   2135: debug-last-xt 0 to trace>depth 0 to trace>recurse trace-xt   \ Trace colon definition
                   2136: THEN
                   2137: ;
                   2138: ' (break-entry) to BP
                   2139: : debug-address ( addr --  )
                   2140: debug-off                       ( xt )  \ Remove active breakpoint
                   2141: dup to debug-last-xt            ( xt )  \ Save token for later debug
                   2142: dup @ to debug-last-xt-content  ( xt )  \ Save old value
                   2143: ['] breakpoint swap !
                   2144: ;
                   2145: : (debug ( xt --  )
                   2146: debug-off                       ( xt )  \ Remove active breakpoint
                   2147: dup to debug-last-xt            ( xt )  \ Save token for later debug
                   2148: dup @ to debug-last-xt-content  ( xt )  \ Save old value
                   2149: ['] breakpoint @ swap !
                   2150: ;
                   2151: : debug ( "old-name<>" -- )
                   2152: parse-word $find IF                       \ Get xt for old-name
                   2153: (debug
                   2154: ELSE
                   2155: ." undefined word " type cr
                   2156: THEN
                   2157: ;
                   2158: : words
                   2159: last @
                   2160: BEGIN ?dup WHILE
                   2161: dup cell+ char+ count type space @
                   2162: REPEAT
                   2163: ;
                   2164: : .calls    ( xt -- )
                   2165: current-node @ >r 0 set-node    \ only search commands, according too IEEE1275
                   2166: last BEGIN @ ?dup WHILE    ( xt currxt )
                   2167: dup cell+ char+         ( xt currxt name* )
                   2168: dup dup c@ + 1+ aligned ( xt currxt name* CFA )
                   2169: dup @ <colon> = IF      ( xt currxt name* CFA )
                   2170: BEGIN
                   2171: cell+ dup @ ['] semicolon <>
                   2172: WHILE                ( xt currxt *name pos )
                   2173: dup @ 4 pick = IF ( xt currxt *name pos )
                   2174: over count type space
                   2175: BEGIN cell+ dup @ ['] semicolon = UNTIL cell - \ eat up other occurences
                   2176: THEN
                   2177: REPEAT
                   2178: THEN
                   2179: 2drop ( xt currxt )
                   2180: REPEAT
                   2181: drop
                   2182: r> set-node               \ restore node
                   2183: ;
                   2184: 0 value #sift-count
                   2185: false value sift-compl-only
                   2186: : $inner-sift ( text-addr text-len LFA -- ... word-addr word-len true | false )
                   2187: dup cell+ char+ count           \ get word name
                   2188: 2dup 6 pick 6 pick find-isubstr \ is there a partly match?
                   2189: sift-compl-only IF 0= ELSE over < THEN
                   2190: IF
                   2191: #sift-count 1+ to #sift-count \ count completions
                   2192: true
                   2193: ELSE
                   2194: 2drop false
                   2195: THEN
                   2196: ;
                   2197: : $sift    ( text-addr text-len -- )
                   2198: current-node @ >r 0 set-node   \ only search commands, according too IEEE1275
                   2199: sift-compl-only >r false to sift-compl-only \ all substrings, not only compl.
                   2200: last BEGIN @ ?dup WHILE        \ walk the whole dictionary
                   2201: $inner-sift IF type space THEN
                   2202: REPEAT
                   2203: 2drop
                   2204: 0 to #sift-count          \ we don't need completions here.
                   2205: r> to sift-compl-only    \ restore previous sifting mode
                   2206: r> set-node               \ restore node
                   2207: ;
                   2208: : sifting    ( "text< >" -- )
                   2209: parse-word $sift
                   2210: ;
                   2211: defer '(r@)
                   2212: defer '(r!)
                   2213: 1 VALUE /(r)
                   2214: : (rfill) ( addr size pattern 'r! /r -- )
                   2215: to /(r) to '(r!) ff and
                   2216: dup 8 lshift or dup 10 lshift or dup 20 lshift or
                   2217: -rot bounds ?do dup i '(r!) /(r) +loop drop
                   2218: ;
                   2219: : (fwrmove) ( src dest size -- )
                   2220: >r 0 -rot r> bounds ?do + dup '(r@) i '(r!) /(r) dup +loop 2drop
                   2221: ;
                   2222: : mrmove ( src dest size -- )
                   2223: 3dup or or 7 AND CASE
                   2224: 0 OF ['] x@ ['] rx! /x ENDOF
                   2225: 4 OF ['] l@ ['] rl! /l ENDOF
                   2226: 2 OF ['] w@ ['] rw! /w ENDOF
                   2227: dup OF ['] c@ ['] rb! /c ENDOF
                   2228: ENDCASE
                   2229: to /(r) to '(r!) to '(r@) (fwrmove)
                   2230: ;
                   2231: : rfill ( addr size pattern -- )
                   2232: 3dup drop or 7 AND CASE
                   2233: 0 OF ['] rx! /x ENDOF
                   2234: 4 OF ['] rl! /l ENDOF
                   2235: 2 OF ['] rw! /w ENDOF
                   2236: dup OF ['] rb! /c ENDOF
                   2237: ENDCASE (rfill)
                   2238: ;
                   2239: : ([IF])
                   2240: BEGIN
                   2241: BEGIN parse-word dup 0= WHILE
                   2242: 2drop refill
                   2243: REPEAT
                   2244: 2dup s" [IF]" str= IF 1 throw THEN
                   2245: 2dup s" [ELSE]" str= IF 2 throw THEN
                   2246: 2dup s" [THEN]" str= IF 3 throw THEN
                   2247: s" \" str= IF linefeed parse 2drop THEN
                   2248: AGAIN
                   2249: ;
                   2250: : [IF] ( flag -- )
                   2251: IF exit THEN
                   2252: 1 BEGIN
                   2253: ['] ([IF]) catch 
                   2254: CASE
                   2255: 1 OF 1+ ENDOF
                   2256: 2 OF dup 1 = if 1- then ENDOF
                   2257: 3 OF 1- ENDOF
                   2258: ENDCASE
                   2259: dup 0 <=
                   2260: UNTIL drop
                   2261: ; immediate
                   2262: : [ELSE] 0 [COMPILE] [IF] ; immediate
                   2263: : [THEN] ; immediate
                   2264: : $dnumber base @ >r decimal $number r> base ! ;
                   2265: : (.d) base @ >r decimal (.) r> base ! ;
                   2266: : (ipaddr) ( "a.b.c.d" -- FALSE | n1 n2 n3 n4 TRUE )
                   2267: base @ >r decimal
                   2268: over s" 000.000.000.000" comp 0= IF 2drop false r> base ! EXIT THEN
                   2269: [char] . left-parse-string $number IF 2drop false r> base ! EXIT THEN -rot
                   2270: [char] . left-parse-string $number IF 2drop false r> base ! EXIT THEN -rot
                   2271: [char] . left-parse-string $number IF 2drop false r> base ! EXIT THEN -rot
                   2272: $number IF false r> base ! EXIT THEN
                   2273: true r> base !
                   2274: ;
                   2275: : (ipformat)  ( n1 n2 n3 n4 -- str len )
                   2276: base @ >r decimal
                   2277: 0 <# # # # [char] . hold drop # # # [char] . hold
                   2278: drop # # # [char] . hold drop # # #s #>
                   2279: r> base !
                   2280: ;
                   2281: : ipformat  ( n1 n2 n3 n4 -- ) (ipformat) type ;
1.1.1.2   root     2282: paflof-start 1 rshift fff not and to load-base
1.1       root     2283: deadbeef here l!
                   2284: here c@ de = CONSTANT ?bigendian
                   2285: here c@ ef = CONSTANT ?littleendian
                   2286: ?bigendian [IF]
                   2287: : l!-le  >r lbflip r> l! ;
                   2288: : l@-le  l@ lbflip ;
                   2289: : w!-le  >r wbflip r> w! ;
                   2290: : w@-le  w@ wbflip ;
1.1.1.3 ! root     2291: : rx!-le  >r xbflip r> rx! ;
        !          2292: : rx@-le  rx@ xbflip ;
1.1       root     2293: : rl!-le  >r lbflip r> rl! ;
                   2294: : rl@-le  rl@ lbflip ;
                   2295: : rw!-le  >r wbflip r> rw! ;
                   2296: : rw@-le  rw@ wbflip ;
                   2297: : l!-be  l! ;
                   2298: : l@-be  l@ ;
                   2299: : w!-be  w! ;
                   2300: : w@-be  w@ ;
                   2301: : rl!-be  rl! ;
                   2302: : rl@-be  rl@ ;
                   2303: : rw!-be  rw! ;
                   2304: : rw@-be  rw@ ;
                   2305: [ELSE]
                   2306: : l!-le  l! ;
                   2307: : l@-le  l@ ;
                   2308: : w!-le  w! ;
                   2309: : w@-le  w@ ;
1.1.1.3 ! root     2310: : rx!-le  rx! ;
        !          2311: : rx@-le  rx@ ;
1.1       root     2312: : rl!-le  rl! ;
                   2313: : rl@-le  rl@ ;
                   2314: : rw!-le  rw! ;
                   2315: : rw@-le  rw@ ;
                   2316: : l!-be  >r lbflip r> l! ;
                   2317: : l@-be  l@ lbflip ;
                   2318: : w!-be  >r wbflip r> w! ;
                   2319: : w@-be  w@ wbflip ;
                   2320: : rl!-be  >r lbflip r> rl! ;
                   2321: : rl@-be  rl@ lbflip ;
                   2322: : rw!-be  >r wbflip r> rw! ;
                   2323: : rw@-be  rw@ wbflip ;
                   2324: [THEN]
                   2325: : #join  ( lo hi #bits -- x )  lshift or ;
                   2326: : #split ( x #bits -- lo hi )  2dup rshift dup >r swap lshift xor r> ;
                   2327: : blink ;
                   2328: : reset-dual-emit ;
                   2329: : console-clean-fifo ;
                   2330: : bootmsg-nvupdate ;
                   2331: : asm-cout 2drop drop ;
                   2332: defer nvramlog-write-byte
                   2333: : .nvramlog-write-byte ( byte -- )
                   2334: drop
                   2335: ;
                   2336: ' .nvramlog-write-byte to nvramlog-write-byte
                   2337: : nvramlog-write-string ( str len -- )
                   2338: dup 0> IF
                   2339: 0 DO dup c@ 
                   2340: nvramlog-write-byte char+ LOOP
                   2341: ELSE
                   2342: drop
                   2343: THEN drop ;
                   2344: : nvramlog-write-number ( number format -- )
                   2345: 0 swap <# 0 ?DO # LOOP #> 
                   2346: nvramlog-write-string ;
                   2347: : nvramlog-write-string-cr ( str len -- )
                   2348: nvramlog-write-string
                   2349: a nvramlog-write-byte d nvramlog-write-byte ;
                   2350: : log-string ( str len -- ) type ;
                   2351: : log-string 2drop ;
                   2352: create debugstr 255 allot
                   2353: 0 VALUE debuglen
                   2354: : cp ( checkpoint -- )
                   2355: bootmsg-cp ;
                   2356: : (warning) ( id level ptr len -- )
                   2357: dup TO debuglen
                   2358: debugstr swap move           \ copy into buffer
                   2359: 0 debuglen debugstr + c!     \ terminate '\0'
                   2360: debugstr bootmsg-warning
                   2361: ;
                   2362: : warning" ( id level [text<">] -- )
                   2363: postpone s" state @
                   2364: IF
                   2365: ['] (warning) compile,
                   2366: ELSE
                   2367: (warning)
                   2368: THEN
                   2369: ; immediate
                   2370: : (debug-cp) ( id level ptr len -- )
                   2371: dup TO debuglen
                   2372: debugstr swap move           \ copy into buffer
                   2373: 0 debuglen debugstr + c!     \ terminate '\0'
                   2374: debugstr bootmsg-debugcp
                   2375: ;
                   2376: : debug-cp" ( id level [text<">] -- )
                   2377: postpone s" state @
                   2378: IF
                   2379: ['] (debug-cp) compile,
                   2380: ELSE
                   2381: (debug-cp)
                   2382: THEN
                   2383: ; immediate
                   2384: : (error) ( id ptr len -- )
                   2385: dup TO debuglen
                   2386: debugstr swap move           \ copy into buffer
                   2387: 0 debuglen debugstr + c!     \ terminate '\0'
                   2388: debugstr bootmsg-error
                   2389: ;
                   2390: : error" ( id level [text<">] -- )
                   2391: postpone s" state @
                   2392: IF
                   2393: ['] (error) compile,
                   2394: ELSE
                   2395: (error)
                   2396: THEN
                   2397: ; immediate
                   2398: bootmsg-nvupdate
                   2399: 000 cp
                   2400: STRUCT
                   2401: cell FIELD >r0   cell FIELD >r1   cell FIELD >r2   cell FIELD >r3
                   2402: cell FIELD >r4   cell FIELD >r5   cell FIELD >r6   cell FIELD >r7
                   2403: cell FIELD >r8   cell FIELD >r9   cell FIELD >r10  cell FIELD >r11
                   2404: cell FIELD >r12  cell FIELD >r13  cell FIELD >r14  cell FIELD >r15
                   2405: cell FIELD >r16  cell FIELD >r17  cell FIELD >r18  cell FIELD >r19
                   2406: cell FIELD >r20  cell FIELD >r21  cell FIELD >r22  cell FIELD >r23
                   2407: cell FIELD >r24  cell FIELD >r25  cell FIELD >r26  cell FIELD >r27
                   2408: cell FIELD >r28  cell FIELD >r29  cell FIELD >r30  cell FIELD >r31
                   2409: cell FIELD >cr   cell FIELD >xer  cell FIELD >lr   cell FIELD >ctr
                   2410: cell FIELD >srr0 cell FIELD >srr1 cell FIELD >dar  cell FIELD >dsisr
                   2411: CONSTANT ciregs-size
                   2412: : .16  10 0.r 3 spaces ;
                   2413: : .8   8 spaces 8 0.r 3 spaces ;
                   2414: : .4regs  cr 4 0 DO dup @ .16 8 cells+ LOOP drop ;
                   2415: : .fixed-regs
                   2416: cr ."     R0 .. R7           R8 .. R15         R16 .. R23         R24 .. R31"
                   2417: dup 8 0 DO dup .4regs cell+ LOOP drop
                   2418: ;
                   2419: : .special-regs
                   2420: cr ."     CR / XER           LR / CTR          SRR0 / SRR1        DAR / DSISR"
                   2421: cr dup >cr  @ .8   dup >lr  @ .16  dup >srr0 @ .16  dup >dar @ .16
                   2422: cr dup >xer @ .16  dup >ctr @ .16  dup >srr1 @ .16    >dsisr @ .8
                   2423: ;
                   2424: : .regs
                   2425: cr .fixed-regs
                   2426: cr .special-regs
                   2427: cr cr
                   2428: ;
                   2429: : .hw-exception ( reason-code exception-nr -- )
                   2430: ." ( " dup . ." ) "
                   2431: CASE
                   2432: 200 OF ." Machine Check" ENDOF
                   2433: 300 OF ." Data Storage" ENDOF
                   2434: 380 OF ." Data Segment" ENDOF
                   2435: 400 OF ." Intruction Storage" ENDOF
                   2436: 480 OF ." Instruction Segment" ENDOF
                   2437: 500 OF ." External" ENDOF
                   2438: 600 OF ." Alignment" ENDOF
                   2439: 700 OF ." Program" ENDOF
                   2440: 800 OF ." Floating-point unavailable" ENDOF
                   2441: 900 OF ." Decrementer" ENDOF
                   2442: 980 OF ." Hypervisor Decrementer" ENDOF
                   2443: C00 OF ." System Call" ENDOF
                   2444: D00 OF ." Trace" ENDOF
                   2445: F00 OF ." Performance Monitor" ENDOF
                   2446: F20 OF ." VMX Unavailable" ENDOF
                   2447: 1200 OF ." System Error" ENDOF
                   2448: 1600 OF ." Maintenance" ENDOF
                   2449: 1800 OF ." Thermal" ENDOF
                   2450: dup OF ." Unknown" ENDOF
                   2451: ENDCASE
                   2452: ."  Exception [ " . ." ]"
                   2453: ;
                   2454: : .sw-exception ( exception-nr -- )
                   2455: ."  Exception [ " . ." ] triggered by boot firmware."
                   2456: ;
                   2457: : be-hw-exception ( [reason-code] exception-nr -- )
                   2458: cr cr
                   2459: dup 0> IF .hw-exception ELSE .sw-exception THEN
                   2460: cr eregs .regs
                   2461: ;
                   2462: ' be-hw-exception to hw-exception-handler
                   2463: : (boot-exception-handler) ( x1...xn exception-nr -- x1...xn)
                   2464: dup IF
                   2465: dup 0 > IF
                   2466: negate cp 9 emit ." : " type
                   2467: ELSE
                   2468: CASE
                   2469: -6d OF cr ." W3411: Client application returned." cr ENDOF
                   2470: -6c OF cr ." E3400: It was not possible to boot from any device "
                   2471: ." specified in the VPD." cr
                   2472: ENDOF
                   2473: -6b OF cr ." E3410: Boot list successfully read from VPD "
                   2474: ." but no useful information received." cr
                   2475: ENDOF
                   2476: -6a OF cr ." E3420: Boot list could not be read from VPD." cr
                   2477: ENDOF
                   2478: -69 OF
                   2479: cr ." E3406: Client application returned an error"
                   2480: abort"-str @ count dup IF
                   2481: ." :    " type cr
                   2482: ELSE
                   2483: ." ." cr
                   2484: 2drop
                   2485: THEN
                   2486: ENDOF
                   2487: -68 OF cr ." E3405: No such device" cr ENDOF
                   2488: -67 OF cr ." E3404: Not a bootable device!" cr ENDOF
                   2489: -66 OF cr ." E3408: Failed to claim memory for the executable" cr
                   2490: ENDOF
                   2491: -65 OF cr ." E3407: Load failed" cr ENDOF
                   2492: -64 OF cr ." E3403: Bad executable:   " abort"-str @ count type cr
                   2493: ENDOF
                   2494: -63 OF cr ." E3409: Unknown FORTH Word" cr ENDOF
                   2495: -2 OF cr ." E3401: Aborting boot,  " abort"-str @ count type cr
                   2496: ENDOF
                   2497: dup OF ." E3402: Aborting boot, internal error" cr ENDOF
                   2498: ENDCASE
                   2499: THEN
                   2500: ELSE
                   2501: drop
                   2502: THEN
                   2503: ;
                   2504: ' (boot-exception-handler) to boot-exception-handler
                   2505: : throw-error ( error-code "error-string" -- )
                   2506: skipws 0a parse rot throw
                   2507: ;
                   2508: : enable-ext-int ( -- )
                   2509: msr@ 8000 or msr!
                   2510: ;
                   2511: : disable-ext-int ( -- )
                   2512: msr@ 8000 not and msr!
                   2513: ;
                   2514: : gen-ext-int ( -- )
                   2515: 7fffffff dec!               \ Reset decrementer
                   2516: enable-ext-int              \ Enable interrupt
                   2517: FF 20000508418 rx!          \ Interrupt priority mask
                   2518: 10 20000508410 rx!          \ Interrupt priority
                   2519: ;
                   2520: : mm-log-warning 2drop ;
                   2521: : write-mm-log ( data length type -- status )
                   2522: 3drop 0
                   2523: ;
                   2524: 100 cp
                   2525: : beep  bell emit ;
                   2526: : TABLE-EXECUTE
                   2527: CREATE DOES> swap cells+ @ ?dup IF execute ELSE beep THEN ;
                   2528: 0 VALUE accept-adr
                   2529: 0 VALUE accept-max
                   2530: 0 VALUE accept-len
                   2531: 0 VALUE accept-cur
                   2532: : esc  1b emit ;
                   2533: : csi  esc 5b emit ;
                   2534: : move-cursor ( -- )
                   2535: esc ." 8" accept-cur IF
                   2536: csi base @ decimal accept-cur 0 .r base ! ." C"
                   2537: THEN
                   2538: ;
                   2539: : redraw-line ( -- )
                   2540: accept-cur accept-len = IF EXIT THEN
                   2541: move-cursor
                   2542: accept-adr accept-len accept-cur /string type
                   2543: csi ." K" move-cursor
                   2544: ;
                   2545: : full-redraw-line ( -- )
                   2546: accept-cur 0 to accept-cur move-cursor
                   2547: accept-adr accept-len type
                   2548: csi ." K" to accept-cur move-cursor
                   2549: ;
                   2550: : redraw-prompt ( -- )
                   2551: cr depth . [char] > emit
                   2552: ;
                   2553: : insert-char ( char -- )
                   2554: accept-len accept-max = IF drop beep EXIT THEN
                   2555: accept-cur accept-len <> IF csi ." @" dup emit
                   2556: accept-adr accept-cur + dup 1+ accept-len accept-cur - move
                   2557: ELSE dup emit THEN
                   2558: accept-adr accept-cur + c!
                   2559: accept-cur 1+ to accept-cur
                   2560: accept-len 1+ to accept-len redraw-line
                   2561: ;
                   2562: : delete-char ( -- )
                   2563: accept-cur accept-len = IF beep EXIT THEN
                   2564: accept-len 1- to accept-len
                   2565: accept-adr accept-cur + dup 1+ swap accept-len accept-cur - move
                   2566: csi ." P" redraw-line
                   2567: ;
                   2568: STRUCT
                   2569: cell FIELD his>next
                   2570: cell FIELD his>prev
                   2571: cell FIELD his>len
                   2572: 0 FIELD his>buf
                   2573: CONSTANT /his
                   2574: 0 VALUE his-head
                   2575: 0 VALUE his-tail
                   2576: 0 VALUE his-cur
                   2577: : add-history ( -- )
                   2578: accept-len 0= IF EXIT THEN
                   2579: /his accept-len + alloc-mem
                   2580: his-tail IF dup his-tail his>next ! ELSE dup to his-head THEN
                   2581: his-tail over his>prev !  0 over his>next !  dup to his-tail
                   2582: accept-len over his>len !  accept-adr swap his>buf accept-len move
                   2583: ;
                   2584: : history  ( -- )
                   2585: his-head BEGIN dup WHILE
                   2586: cr dup his>buf over his>len @ type
                   2587: his>next @ REPEAT drop
                   2588: ;
                   2589: : select-history ( his -- )
                   2590: dup to his-cur dup IF
                   2591: dup his>len @ accept-max min dup to accept-len to accept-cur
                   2592: his>buf accept-adr accept-len move ELSE
                   2593: drop 0 to accept-len 0 to accept-cur THEN
                   2594: full-redraw-line
                   2595: ;
                   2596: 0 value ?tab-pressed
                   2597: 0 value tab-last-adr
                   2598: 0 value tab-last-len
                   2599: : $same-string ( addr-1 len-1 addr-2 len-2 -- addr-1 len-1' )
                   2600: dup 0= IF    \ The second parameter is not a string.
                   2601: 2drop EXIT \ bail out
                   2602: THEN
                   2603: rot min 0 0 -rot ( addr1 addr2 0 len' 0 )
                   2604: DO ( addr1 addr2 len-1' )
                   2605: 2 pick i + c@ lcc
                   2606: 2 pick i + c@ lcc
                   2607: = IF 1 + ELSE leave THEN
                   2608: LOOP
                   2609: nip
                   2610: ;
                   2611: : $tab-sift-words    ( text-addr text-len -- sift-count )
                   2612: sift-compl-only >r true to sift-compl-only \ save sifting mode
                   2613: last BEGIN @ ?dup WHILE \ loop over all words
                   2614: $inner-sift IF \ any completions possible?
                   2615: 2dup bounds DO I c@ lcc I c! LOOP
                   2616: ?tab-pressed IF 2dup type space THEN  \ <tab><tab> prints possibilities
                   2617: tab-last-adr tab-last-len $same-string \ find matching substring ...
                   2618: to tab-last-len to tab-last-adr       \ ... and save it
                   2619: THEN
                   2620: repeat
                   2621: 2drop
                   2622: #sift-count 0 to #sift-count   \ how many words were found?
                   2623: r> to sift-compl-only          \ restore sifting completion mode
                   2624: ;
                   2625: 0 value current-stack
                   2626: : new-stack ( cells <>name -- )
                   2627: create >r here    ( here R: cells )
                   2628: dup r@ 2 + cells  ( here here bytes R: cells )
                   2629: dup allot erase   ( here R: cells)
                   2630: cell+ r>          ( here+1cell cells )
                   2631: swap !            ( )
                   2632: DOES> to current-stack
                   2633: ;
                   2634: : reset-stack ( -- )
                   2635: 0 current-stack !
                   2636: ;
                   2637: : stack-depth ( -- depth )
                   2638: current-stack @
                   2639: ;
                   2640: : push ( value -- )
                   2641: current-stack @
                   2642: current-stack cell+ @ over <= ABORT" Stack overflow"
                   2643: cells
                   2644: 1 current-stack +!
                   2645: current-stack 2 cells + + !
                   2646: ;
                   2647: : pop ( -- value )
                   2648: current-stack @ 0= ABORT" Stack underflow"
                   2649: current-stack @ cells
                   2650: current-stack + cell+ @
                   2651: -1 current-stack +!
                   2652: ;
                   2653: 10 new-stack device-stack
                   2654: : (next-dev) ( node -- node' addr len )
                   2655: device-stack
                   2656: dup (node>path) rot
                   2657: dup child IF dup push child -rot EXIT THEN
                   2658: dup peer IF peer -rot EXIT THEN
                   2659: drop
                   2660: BEGIN
                   2661: stack-depth
                   2662: WHILE
                   2663: pop peer ?dup IF -rot EXIT THEN
                   2664: REPEAT
                   2665: 0 -rot
                   2666: ;
                   2667: : $inner-sift-nodes ( text-addr text-len node -- ... path-addr path-len true | false )
                   2668: (next-dev) ( text-addr text-len node' path-addr path-len )
                   2669: dup 0= IF drop false EXIT THEN
                   2670: 2dup 6 pick 6 pick find-isubstr ( text-addr text-len node' path-addr path-len pos )
                   2671: 0= IF
                   2672: #sift-count 1+ to #sift-count \ count completions
                   2673: true
                   2674: ELSE
                   2675: 2drop false
                   2676: THEN
                   2677: ;
                   2678: : .nodes ( -- )
                   2679: s" /" find-node BEGIN dup WHILE
                   2680: (next-dev)
                   2681: type cr
                   2682: REPEAT
                   2683: drop
                   2684: reset-stack
                   2685: ;
                   2686: create sift-node-buffer 1000 allot
                   2687: 0 value sift-node-num
                   2688: : sift-node-buffer
                   2689: sift-node-buffer sift-node-num 100 * +
                   2690: sift-node-num 1+ dup 10 = IF drop 0 THEN
                   2691: to sift-node-num
                   2692: ;
                   2693: : $tab-sift-nodes    ( text-addr text-len -- sift-count )
                   2694: s" /" find-node BEGIN dup WHILE
                   2695: $inner-sift-nodes IF \ any completions possible?
                   2696: sift-node-buffer swap 2>r 2r@ move 2r> \ make an almost permanent copy without strdup
                   2697: ?tab-pressed IF 2dup type space THEN  \ <tab><tab> prints possibilities
                   2698: tab-last-adr tab-last-len $same-string \ find matching substring ...
                   2699: to tab-last-len to tab-last-adr       \ ... and save it
                   2700: THEN
                   2701: REPEAT
                   2702: 2drop drop
                   2703: #sift-count 0 to #sift-count   \ how many words were found?
                   2704: reset-stack
                   2705: ;
                   2706: : $tab-sift    ( text-addr text-len -- sift-count )
                   2707: ?tab-pressed IF beep space THEN \ cosmetical fix for <tab><tab>
                   2708: dup IF bl rsplit dup IF 2swap THEN ELSE 0 0 THEN >r >r
                   2709: 0 dup to tab-last-len to tab-last-adr  \ reset last possible match
                   2710: current-node @ IF                      \ if we are in a node?
                   2711: 2dup 2>r                               \ save text
                   2712: $tab-sift-words to #sift-count \ search in current node first
                   2713: 2r>                            \ fetch text to complete, again
                   2714: THEN
                   2715: 2dup 2>r
                   2716: current-node @ >r 0 set-node           \ now search in global words
                   2717: $tab-sift-words to #sift-count
                   2718: r> set-node
                   2719: 2r> $tab-sift-nodes
                   2720: r> r> dup IF s"  " $cat THEN tab-last-adr tab-last-len $cat
                   2721: to tab-last-len to tab-last-adr  \ ... and save the whole string
                   2722: ;
                   2723: : handle-^A
                   2724: 0 to accept-cur move-cursor ;
                   2725: : handle-^B
                   2726: accept-cur ?dup IF 1- to accept-cur ( csi ." D" ) move-cursor THEN ;
                   2727: : handle-^D
                   2728: delete-char ( redraw-line ) ;
                   2729: : handle-^E
                   2730: accept-len to accept-cur move-cursor ;
                   2731: : handle-^F
                   2732: accept-cur accept-len <> IF accept-cur 1+ to accept-cur csi ." C" THEN ;
                   2733: : handle-^H
                   2734: accept-cur 0= IF beep EXIT THEN
                   2735: handle-^B delete-char
                   2736: ;
                   2737: : handle-^I
                   2738: accept-adr accept-len
                   2739: $tab-sift 0 > IF
                   2740: ?tab-pressed IF
                   2741: redraw-prompt full-redraw-line
                   2742: false to ?tab-pressed
                   2743: ELSE
                   2744: tab-last-adr accept-adr tab-last-len move    \ copy matching substring
                   2745: tab-last-len dup to accept-len to accept-cur \ len and cursor position
                   2746: full-redraw-line               \ redraw new string
                   2747: true to ?tab-pressed   \ second tab will print possible matches
                   2748: THEN
                   2749: THEN
                   2750: ;
                   2751: : handle-^K
                   2752: BEGIN accept-cur accept-len <> WHILE delete-char REPEAT ;
                   2753: : handle-^L
                   2754: history redraw-prompt full-redraw-line ;
                   2755: : handle-^N
                   2756: his-cur IF his-cur his>next @ ELSE his-head THEN
                   2757: dup to his-cur select-history
                   2758: ;
                   2759: : handle-^P
                   2760: his-cur IF his-cur his>prev @ ELSE his-tail THEN
                   2761: dup to his-cur select-history
                   2762: ;
                   2763: : handle-^Q  \ Does not handle terminal formatting yet.
                   2764: key insert-char ;
                   2765: : handle-^R
                   2766: full-redraw-line ;
                   2767: : handle-^U
                   2768: 0 to accept-len 0 to accept-cur full-redraw-line ;
                   2769: : handle-fn
                   2770: key drop beep
                   2771: ;
                   2772: TABLE-EXECUTE handle-CSI
                   2773: 0 , ' handle-^P , ' handle-^N , ' handle-^F ,
                   2774: ' handle-^B , 0 , 0 , 0 ,
                   2775: ' handle-^A , 0 , 0 , ' handle-^E ,
                   2776: 0 , 0 , 0 , 0 ,
                   2777: 0 , 0 , 0 , 0 ,
                   2778: 0 , 0 , 0 , 0 ,
                   2779: 0 , 0 , 0 , 0 ,
                   2780: 0 , 0 , 0 , 0 ,
                   2781: TABLE-EXECUTE handle-meta
                   2782: 0 , 0 , 0 , 0 ,
                   2783: 0 , 0 , 0 , 0 ,
                   2784: 0 , 0 , 0 , 0 ,
                   2785: 0 , 0 , 0 , ' handle-fn ,
                   2786: 0 , 0 , 0 , 0 ,
                   2787: 0 , 0 , 0 , 0 ,
                   2788: 0 , 0 , 0 , ' handle-CSI ,
                   2789: 0 , 0 , 0 , 0 ,
                   2790: : handle-ESC-O
                   2791: key
                   2792: dup 48 = IF
                   2793: handle-^A
                   2794: ELSE
                   2795: dup 46 = IF
                   2796: handle-^E
                   2797: THEN
                   2798: THEN drop
                   2799: ;
                   2800: : handle-ESC-5b
                   2801: key
                   2802: dup 31 = IF \ HOME
                   2803: key drop ( drops closing 7e ) handle-^A
                   2804: ELSE
                   2805: dup 33 = IF \ DEL
                   2806: key drop handle-^D
                   2807: ELSE
                   2808: dup 34 = IF \ END
                   2809: key drop handle-^E
                   2810: ELSE
                   2811: dup 1f and handle-CSI
                   2812: THEN
                   2813: THEN
                   2814: THEN drop
                   2815: ;
                   2816: : handle-ESC
                   2817: key
                   2818: dup 5b = IF
                   2819: handle-ESC-5b
                   2820: ELSE
                   2821: dup 4f = IF
                   2822: handle-ESC-O
                   2823: ELSE
                   2824: dup 1f and handle-meta
                   2825: THEN
                   2826: THEN drop
                   2827: ;
                   2828: TABLE-EXECUTE handle-control
                   2829: 0 , \ ^@:
                   2830: ' handle-^A ,
                   2831: ' handle-^B ,
                   2832: 0 , \ ^C:
                   2833: ' handle-^D ,
                   2834: ' handle-^E ,
                   2835: ' handle-^F ,
                   2836: 0 , \ ^G:
                   2837: ' handle-^H ,
                   2838: ' handle-^I , \ tab
                   2839: 0 , \ ^J:
                   2840: ' handle-^K ,
                   2841: ' handle-^L ,
                   2842: 0 , \ ^M: enter: handled in main loop
                   2843: ' handle-^N ,
                   2844: 0 , \ ^O:
                   2845: ' handle-^P ,
                   2846: ' handle-^Q ,
                   2847: ' handle-^R ,
                   2848: 0 , \ ^S:
                   2849: 0 , \ ^T:
                   2850: ' handle-^U ,
                   2851: 0 , \ ^V:
                   2852: 0 , \ ^W:
                   2853: 0 , \ ^X:
                   2854: 0 , \ ^Y: insert save buffer
                   2855: 0 , \ ^Z:
                   2856: ' handle-ESC ,
                   2857: 0 , \ ^\:
                   2858: 0 , \ ^]:
                   2859: 0 , \ ^^:
                   2860: 0 , \ ^_:
                   2861: : (accept) ( adr len -- len' )
                   2862: cursor-on
                   2863: to accept-max to accept-adr
                   2864: 0 to accept-len 0 to accept-cur
                   2865: 0 to his-cur
                   2866: 1b emit 37 emit
                   2867: BEGIN
                   2868: key dup 0d <>
                   2869: WHILE
                   2870: dup 9 <> IF 0 to ?tab-pressed THEN \ reset state machine
                   2871: dup 7f = IF drop 8 THEN \ Handle DEL as if it was BS. ??? bogus
                   2872: dup bl < IF handle-control ELSE
                   2873: dup 80 and IF
                   2874: dup a0 < IF 7f and handle-meta ELSE drop beep THEN
                   2875: ELSE
                   2876: insert-char
                   2877: THEN
                   2878: THEN
                   2879: REPEAT
                   2880: drop add-history
                   2881: accept-len to accept-cur
                   2882: move-cursor space
                   2883: accept-len
                   2884: cursor-off
                   2885: ;
                   2886: ' (accept) to accept
                   2887: 120 cp
                   2888: 1 VALUE /dump
                   2889: ' c@ VALUE 'dump
                   2890: 0 VALUE dump-first
                   2891: 0 VALUE dump-last
                   2892: 0 VALUE dump-cur
                   2893: : .char ( c -- )  dup bl 7f within 0= IF drop [char] . THEN emit ;
                   2894: : dump-line ( -- )
                   2895: cr dump-cur dup 8 0.r [char] : emit 10 /dump / 0 DO
                   2896: space dump-cur dump-first dump-last within IF
                   2897: dump-cur 'dump execute /dump 2* 0.r ELSE
                   2898: /dump 2* spaces THEN dump-cur /dump + to dump-cur LOOP
                   2899: /dump 1 <> IF drop EXIT THEN
                   2900: to dump-cur 2 spaces
                   2901: 10 0 DO dump-cur dump-first dump-last within IF
                   2902: dump-cur 'dump execute .char ELSE space THEN dump-cur 1+ to dump-cur LOOP ;
                   2903: : (dump) ( addr len reader size -- )
                   2904: to /dump to 'dump bounds /dump negate and to dump-first to dump-last
                   2905: dump-first f invert and to dump-cur
                   2906: base @ hex BEGIN dump-line dump-cur dump-last >= UNTIL base ! ;
                   2907: : du ( -- )  dump-last 100 'dump /dump (dump) ;
                   2908: : dump     ['] c@      1 (dump) ;
                   2909: : wdump    ['] w@      2 (dump) ;
                   2910: : ldump    ['] l@      4 (dump) ;
                   2911: : xdump    ['] x@      8 (dump) ;
                   2912: : rdump    ['] rb@     1 (dump) ;
                   2913: cistack ciregs >r1 ! \ kernel wants a stack :-)
1.1.1.3 ! root     2914: 140 cp
1.1       root     2915: STRUCT
                   2916: cell field romfs>file-header
                   2917: cell field romfs>data
                   2918: cell field romfs>data-size
                   2919: cell field romfs>flags
                   2920: CONSTANT /romfs-lookup-control-block
                   2921: CREATE romfs-lookup-cb /romfs-lookup-control-block allot
                   2922: romfs-lookup-cb /romfs-lookup-control-block erase
                   2923: : create-filename ( string -- string\0 )
                   2924: here >r dup 8 + allot
                   2925: r@ over 8 + erase
                   2926: r@ zplace r> ;
                   2927: : romfs-lookup ( fn-str fn-len -- data size | false )
                   2928: create-filename romfs-base
                   2929: romfs-lookup-cb romfs-lookup-entry call-c
                   2930: 0= IF romfs-lookup-cb dup romfs>data @ swap romfs>data-size @ ELSE
                   2931: false THEN ;
                   2932: : ibm,romfs-lookup ( fn-str fn-len -- data-high data-low size | 0 0 false )
                   2933: romfs-lookup dup
                   2934: 0= if drop 0 0 false else
                   2935: swap dup 20 rshift swap ffffffff and then ;
                   2936: : romfs-lookup-client ibm,romfs-lookup ;
                   2937: STRUCT
                   2938: cell field romfs>next-off
                   2939: cell field romfs>size
                   2940: cell field romfs>flags
                   2941: cell field romfs>data-off
                   2942: cell field romfs>name
                   2943: CONSTANT /romfs-cb
                   2944: : romfs-map-file ( fn-str fn-len -- file-addr file-size )
                   2945: romfs-base >r
                   2946: BEGIN 2dup r@ romfs>name zcount string=ci not WHILE
                   2947: ( fn-str fn-len ) ( R: rom-cb-file-addr )
                   2948: r> romfs>next-off dup @ dup 0= IF 1 THROW THEN + >r REPEAT
                   2949: ( fn-str fn-len ) ( R: rom-cb-file-addr )
                   2950: 2drop r@ romfs>data-off @ r@ + r> romfs>size @ ;
                   2951: : flash-header ( -- address | false )
                   2952: get-flash-base 28 +         \ prepare flash header file address
                   2953: dup rx@                     \ fetch "magic123"
                   2954: 6d61676963313233 <> IF      \ IF flash is not valid
                   2955: drop                     \ | forget address
                   2956: false                    \ | return false
                   2957: THEN                        \ FI
                   2958: ;
                   2959: CREATE bdate-str 10 allot
                   2960: : bdate2human ( -- addr len )
                   2961: flash-header 40 + rx@ (.)
                   2962: drop dup 0 + bdate-str 6 + 4 move
                   2963: dup 4 + bdate-str 0 + 2 move
                   2964: dup 6 + bdate-str 3 + 2 move
                   2965: dup 8 + bdate-str b + 2 move
                   2966: a + bdate-str e + 2 move
                   2967: 2d bdate-str 2 + c!
                   2968: 2d bdate-str 5 + c!
                   2969: 20 bdate-str a + c!
                   2970: 3a bdate-str d + c!
                   2971: bdate-str 10
                   2972: ;
                   2973: : included  ( fn fn-len -- )
                   2974: 2dup >r >r romfs-lookup dup IF
                   2975: r> drop r> drop evaluate
                   2976: ELSE
                   2977: drop ." Cannot open file : " r> r> type cr
                   2978: THEN
                   2979: ;
                   2980: : include  ( " fn " -- )
                   2981: parse-word included
                   2982: ;
                   2983: : ?include  ( flag " fn " -- )
                   2984: parse-word rot IF included ELSE 2drop THEN
                   2985: ;
                   2986: : include?  ( nargs flag " fn " -- )
                   2987: parse-word rot IF
                   2988: rot drop included
                   2989: ELSE
                   2990: 2drop 0 ?DO drop LOOP
                   2991: THEN
                   2992: ;
                   2993: : (print-romfs-file-info)  ( file-addr -- )
                   2994: 9 emit  dup b 0.r  2 spaces  dup 8 + @ 6 0.r  2 spaces  20 + zcount type cr
                   2995: ;
                   2996: : romfs-list  ( -- )
                   2997: romfs-base 0 cr BEGIN + dup (print-romfs-file-info) dup @ dup 0= UNTIL 2drop
                   2998: ;
                   2999: 200 cp
                   3000: : .slof-logo
                   3001: cr ."         ..`. ..     .......  ..           ......      ......."
                   3002: cr ."     ..`...`''.`'. .''``````..''.       .`''```''`.  `''``````"
                   3003: cr ."        .`` .:' ': `''.....  .''.       ''`     .''..''......."
                   3004: cr ."          ``.':.';. ``````''`.''.      .''.      ''``''`````'`"
                   3005: cr ."          ``.':':`   .....`''.`'`...... `'`.....`''.`'`       "
                   3006: cr ."         .`.`'``   .'`'`````.  ``''''''  ``''`'''`. `'`       "
                   3007: ;
1.1.1.3 ! root     3008: 201 cp
1.1       root     3009: : banner
                   3010: cr ."   Type 'boot'  and press return  to  continue  booting  the system."
                   3011: s" /packages/sms" find-node IF
                   3012: cr ."   Type 'sms-start' and press return to enter the configuration menu."
                   3013: THEN
                   3014: cr ."   Type 'reset-all'  and  press  return  to   reboot   the   system."
                   3015: cr cr
                   3016: ;
                   3017: : .banner banner console-clean-fifo ;
                   3018: : .banner .slof-logo .banner ;
                   3019: 220 cp
                   3020: DEFER find-boot-sector ( -- )
                   3021: 240 cp
                   3022: d# 512000000 VALUE tb-frequency   \ default value - needed for "ms" to work
                   3023: -1 VALUE cpu-frequency
                   3024: : slof-build-id  ( -- str len )
                   3025: flash-header 10 + a
                   3026: ;
                   3027: : slof-revision s" 001" ;
                   3028: : read-version-and-date
                   3029: flash-header 0= IF
                   3030: s"  " encode-string
                   3031: ELSE
                   3032: flash-header 10 + 10
                   3033: here swap rmove
                   3034: here 10
                   3035: s" , " $cat
                   3036: bdate2human $cat encode-string THEN
                   3037: ;
                   3038: : from-cstring ( addr - len )  
                   3039: dup dup BEGIN c@ 0 <> WHILE 1 + dup REPEAT
                   3040: swap -
                   3041: ;
                   3042: 260 cp
                   3043: : tb@  ( -- tb )
                   3044: BEGIN tbu@ tbl@ tbu@ rot over <> WHILE 2drop REPEAT
                   3045: 20 lshift swap ffffffff and or
                   3046: ;
                   3047: : milliseconds ( -- ms ) tb@ d# 1000 * tb-frequency / ;
                   3048: : microseconds ( -- us ) tb@ d# 1000000 * tb-frequency / ;
                   3049: : ms ( ms-to-wait -- ) milliseconds + BEGIN milliseconds over >= UNTIL drop ;
                   3050: : get-msecs ( -- n ) milliseconds ;
                   3051: : us  ( us-to-wait -- )  microseconds +  BEGIN microseconds over >= UNTIL  drop ;
1.1.1.3 ! root     3052: 270 cp
        !          3053: variable ip
        !          3054: variable fcode-end 
        !          3055: variable fcode-num
        !          3056: 1 value fcode-spread
        !          3057: 2 value fcode-offset
        !          3058: false value eva-debug?
        !          3059: true value fcode-debug?
        !          3060: defer fcode-rb@
        !          3061: defer fcode@
        !          3062: ' c@ to fcode-rb@
        !          3063: create token-table 2000 cells allot    \ 1000h = 4096d
        !          3064: : ?offset16 ( -- true|false )
        !          3065: fcode-offset 2 =
1.1       root     3066: ;
1.1.1.3 ! root     3067: : ?arch64 ( -- true|false )
        !          3068: cell 8 =
1.1       root     3069: ;
1.1.1.3 ! root     3070: : ?bigendian ( -- true|false )
        !          3071: deadbeef fcode-num !
        !          3072: fcode-num ?arch64 IF 4 + THEN
        !          3073: c@ de =
1.1       root     3074: ;
1.1.1.3 ! root     3075: : reset-fcode-end ( -- )
        !          3076: false fcode-end !
1.1       root     3077: ;
1.1.1.3 ! root     3078: : get-ip ( -- n )
        !          3079: ip @
1.1       root     3080: ;
1.1.1.3 ! root     3081: : set-ip ( n -- )
        !          3082: ip !
1.1       root     3083: ;
1.1.1.3 ! root     3084: : next-ip ( -- )
        !          3085: get-ip 1+ set-ip
1.1       root     3086: ;
1.1.1.3 ! root     3087: : jump-n-ip ( n -- )
        !          3088: get-ip + set-ip
1.1       root     3089: ;
1.1.1.3 ! root     3090: : read-byte ( -- n )
        !          3091: get-ip fcode-rb@
1.1       root     3092: ;
1.1.1.3 ! root     3093: : ?compile-mode ( -- on|off )
        !          3094: state @
1.1       root     3095: ;
1.1.1.3 ! root     3096: : save-evaluator-state
        !          3097: get-ip               eva-debug? IF ." saved ip "           dup . cr THEN
        !          3098: fcode-end @          eva-debug? IF ." saved fcode-end "    dup . cr THEN
        !          3099: fcode-offset         eva-debug? IF ." saved fcode-offset " dup . cr THEN
        !          3100: fcode-spread         eva-debug? IF ." saved fcode-spread " dup . cr THEN
        !          3101: ['] fcode@ behavior  eva-debug? IF ." saved fcode@ "       dup . cr THEN
1.1       root     3102: ;
1.1.1.3 ! root     3103: : restore-evaluator-state
        !          3104: eva-debug? IF ." restored fcode@ "       dup . cr THEN  to fcode@
        !          3105: eva-debug? IF ." restored fcode-spread " dup . cr THEN  to fcode-spread
        !          3106: eva-debug? IF ." restored fcode-offset " dup . cr THEN  to fcode-offset
        !          3107: eva-debug? IF ." restored fcode-end "    dup . cr THEN  fcode-end !
        !          3108: eva-debug? IF ." restored ip "           dup . cr THEN  set-ip
1.1       root     3109: ;
1.1.1.3 ! root     3110: : token-table-index ( fcode# -- addr )
        !          3111: cells token-table +
        !          3112: ;
        !          3113: : join-immediate ( xt immediate? addr -- xt+immediate? addr )
        !          3114: -rot + swap
        !          3115: ;
        !          3116: : split-immediate ( xt+immediate? -- xt immediate? )
        !          3117: dup 1 and 2dup - rot drop swap
        !          3118: ;
        !          3119: : literal, ( n -- )
        !          3120: postpone literal
        !          3121: ;
        !          3122: : fc-string,
        !          3123: postpone sliteral
        !          3124: dup c, bounds ?do i c@ c, loop
        !          3125: ;
        !          3126: : set-token ( xt immediate? fcode# -- )
        !          3127: token-table-index join-immediate !
        !          3128: ;
        !          3129: : get-token ( fcode# -- xt immediate? )
        !          3130: token-table-index @ split-immediate
        !          3131: ;
        !          3132: ?bigendian [IF]                       \ Big endian access functions first
        !          3133: : read-fcode-num16 ( -- n )
        !          3134: 0 fcode-num !
        !          3135: ?arch64 IF
        !          3136: read-byte fcode-num 6 + C!
        !          3137: next-ip
        !          3138: read-byte fcode-num 7 + C!
1.1       root     3139: ELSE
1.1.1.3 ! root     3140: read-byte fcode-num 2 + C!
        !          3141: next-ip
        !          3142: read-byte fcode-num 3 + C!
1.1       root     3143: THEN
1.1.1.3 ! root     3144: fcode-num @
1.1       root     3145: ;
1.1.1.3 ! root     3146: : read-fcode-num32 ( -- n )
        !          3147: 0 fcode-num !
        !          3148: ?arch64 IF
        !          3149: read-byte fcode-num 4 + C!
        !          3150: next-ip
        !          3151: read-byte fcode-num 5 + C!
        !          3152: next-ip
        !          3153: read-byte fcode-num 6 + C!
        !          3154: next-ip
        !          3155: read-byte fcode-num 7 + C!
        !          3156: ELSE
        !          3157: read-byte fcode-num 0 + C!
        !          3158: next-ip
        !          3159: read-byte fcode-num 1 + C!
        !          3160: next-ip
        !          3161: read-byte fcode-num 2 + C!
        !          3162: next-ip
        !          3163: read-byte fcode-num 3 + C!
1.1       root     3164: THEN
1.1.1.3 ! root     3165: fcode-num @
1.1       root     3166: ;
1.1.1.3 ! root     3167: [ELSE]                                \ Now the little endian access functions
        !          3168: : read-fcode-num16 ( -- n )
        !          3169: 0 fcode-num !
        !          3170: ?arch64 IF
        !          3171: read-byte fcode-num 7 + C!
        !          3172: next-ip
        !          3173: read-byte fcode-num 6 + C!
1.1       root     3174: ELSE
1.1.1.3 ! root     3175: read-byte fcode-num 1 + C!
        !          3176: next-ip
        !          3177: read-byte fcode-num 0 + C!
1.1       root     3178: THEN
1.1.1.3 ! root     3179: fcode-num @
        !          3180: ;
        !          3181: : read-fcode-num32 ( adr -- n )
        !          3182: 0 fcode-num !
        !          3183: ?arch64 IF
        !          3184: read-byte fcode-num 7 + C!
        !          3185: next-ip
        !          3186: read-byte fcode-num 6 + C!
        !          3187: next-ip
        !          3188: read-byte fcode-num 5 + C!
        !          3189: next-ip
        !          3190: read-byte fcode-num 4 + C!
1.1       root     3191: ELSE
1.1.1.3 ! root     3192: read-byte fcode-num 3 + C!
        !          3193: next-ip
        !          3194: read-byte fcode-num 2 + C!
        !          3195: next-ip
        !          3196: read-byte fcode-num 1 + C!
        !          3197: next-ip
        !          3198: read-byte fcode-num 0 + C!
1.1       root     3199: THEN
1.1.1.3 ! root     3200: fcode-num @
1.1       root     3201: ;
1.1.1.3 ! root     3202: [THEN]
        !          3203: : read-fcode# ( -- FCode# )
        !          3204: read-byte
        !          3205: dup 01 0F between IF drop read-fcode-num16 THEN
1.1       root     3206: ;
1.1.1.3 ! root     3207: : read-header ( adr -- )
        !          3208: next-ip read-byte        drop
        !          3209: next-ip read-fcode-num16 drop
        !          3210: next-ip read-fcode-num32 drop
1.1       root     3211: ;
1.1.1.3 ! root     3212: : read-fcode-string ( -- str len )
        !          3213: read-byte            \ get string length ( -- len )
        !          3214: next-ip get-ip       \ get string addr   ( -- len str )
        !          3215: swap                 \ type needs the parameters swapped ( -- str len )
        !          3216: dup 1- jump-n-ip     \ jump to the end of the string in FCode
1.1       root     3217: ;
1.1.1.3 ! root     3218: -1 VALUE break-fcode-addr
        !          3219: 0 VALUE break-fcode-steps
        !          3220: : evaluate-fcode ( -- )
        !          3221: BEGIN
        !          3222: get-ip break-fcode-addr = IF
        !          3223: TRUE fcode-end !
1.1       root     3224: THEN
1.1.1.3 ! root     3225: fcode-end @ 0=
        !          3226: WHILE
        !          3227: fcode@                               ( fcode# )
        !          3228: eva-debug? IF
        !          3229: dup
        !          3230: get-ip 8 u.r ." : "
        !          3231: ." [" 3 u.r ." ] "
1.1       root     3232: THEN
1.1.1.3 ! root     3233: get-token 0= ?compile-mode AND IF    ( xt )
        !          3234: compile,
        !          3235: ELSE                                 \ immediate or "interpretation" mode
        !          3236: eva-debug? IF dup xt>name type space THEN
        !          3237: execute
1.1       root     3238: THEN
1.1.1.3 ! root     3239: eva-debug? IF .s cr THEN
        !          3240: break-fcode-steps IF
        !          3241: break-fcode-steps 1- TO break-fcode-steps
        !          3242: break-fcode-steps 0= IF
        !          3243: TRUE fcode-end !
1.1       root     3244: THEN
                   3245: THEN
1.1.1.3 ! root     3246: next-ip
        !          3247: REPEAT
1.1       root     3248: ;
1.1.1.3 ! root     3249: : steps-fcode  ( n -- )
        !          3250: to break-fcode-steps
        !          3251: break-fcode-addr >r -1 to break-fcode-addr
        !          3252: reset-fcode-end
        !          3253: evaluate-fcode
        !          3254: r> to break-fcode-addr
1.1       root     3255: ;
1.1.1.3 ! root     3256: : step-fcode  ( -- )
        !          3257: 1 steps-fcode
1.1       root     3258: ;
1.1.1.3 ! root     3259: : fcode-revision ( -- n )
        !          3260: 00030000 \ major * 65536 + minor
1.1       root     3261: ;
1.1.1.3 ! root     3262: : b(lit) ( -- n )
        !          3263: next-ip read-fcode-num32
        !          3264: ?compile-mode IF literal, THEN
1.1       root     3265: ;
1.1.1.3 ! root     3266: : b(")
        !          3267: next-ip read-fcode-string
        !          3268: ?compile-mode IF fc-string, align postpone count THEN
1.1       root     3269: ;
1.1.1.3 ! root     3270: : b(')
        !          3271: next-ip read-fcode# get-token drop ?compile-mode IF literal, THEN
1.1       root     3272: ;
1.1.1.3 ! root     3273: : ?jump-direction ( n -- )
        !          3274: dup 8000 >= IF
        !          3275: 10000 -           \ Create cell-sized negative value
1.1       root     3276: THEN
1.1.1.3 ! root     3277: fcode-offset -       \ IP is already behind offset, so substract offset size
1.1       root     3278: ;
1.1.1.3 ! root     3279: : ?negative
        !          3280: 8000 and
1.1       root     3281: ;
1.1.1.3 ! root     3282: : dest-on-top
        !          3283: 0 >r BEGIN dup @ 0= WHILE >r REPEAT
        !          3284: BEGIN r> dup WHILE swap REPEAT
        !          3285: drop
1.1       root     3286: ;
1.1.1.3 ! root     3287: : read-fcode-offset
        !          3288: next-ip
        !          3289: ?offset16 IF
        !          3290: read-fcode-num16
        !          3291: ELSE
        !          3292: read-byte
        !          3293: dup 80 and IF FF00 or THEN       \ Fake 16-bit signed offset
1.1       root     3294: THEN
                   3295: ;
1.1.1.3 ! root     3296: : b?branch ( flag -- )
        !          3297: ?compile-mode IF
        !          3298: read-fcode-offset ?negative IF
        !          3299: dest-on-top postpone until
        !          3300: ELSE
        !          3301: postpone if
        !          3302: THEN
        !          3303: ELSE
        !          3304: ( flag ) IF
        !          3305: fcode-offset jump-n-ip       \ Skip over offset value
        !          3306: ELSE
        !          3307: read-fcode-offset
        !          3308: ?jump-direction jump-n-ip
        !          3309: THEN
        !          3310: THEN
        !          3311: ; immediate
        !          3312: : bbranch ( -- )
        !          3313: ?compile-mode IF
        !          3314: read-fcode-offset
        !          3315: ?negative IF
        !          3316: dest-on-top postpone again
1.1       root     3317: ELSE
1.1.1.3 ! root     3318: postpone else
        !          3319: get-ip next-ip fcode@ B2 = IF
1.1       root     3320: drop
1.1.1.3 ! root     3321: ELSE
        !          3322: set-ip
1.1       root     3323: THEN
1.1.1.3 ! root     3324: THEN
        !          3325: ELSE
        !          3326: read-fcode-offset ?jump-direction jump-n-ip
        !          3327: THEN
        !          3328: ; immediate
        !          3329: : b(<mark) ( -- )
        !          3330: ?compile-mode IF postpone begin THEN
        !          3331: ; immediate
        !          3332: : b(>resolve) ( -- )
        !          3333: ?compile-mode IF postpone then THEN
        !          3334: ; immediate
        !          3335: : b(;)
        !          3336: <semicolon> compile, reveal
        !          3337: postpone [
        !          3338: ; immediate
        !          3339: : b(:) ( -- )
        !          3340: <colon> compile, ]
        !          3341: ; immediate
        !          3342: : b(case) ( sel -- sel )
        !          3343: postpone case
        !          3344: ; immediate
        !          3345: : b(endcase)
        !          3346: postpone endcase
        !          3347: ; immediate
        !          3348: : b(of)
        !          3349: postpone of
        !          3350: read-fcode-offset drop   \ read and discard offset
        !          3351: ; immediate
        !          3352: : b(endof)
        !          3353: postpone endof
        !          3354: read-fcode-offset drop
        !          3355: ; immediate
        !          3356: : b(do)
        !          3357: postpone do
        !          3358: read-fcode-offset drop
        !          3359: ; immediate
        !          3360: : b(?do)
        !          3361: postpone ?do
        !          3362: read-fcode-offset drop
        !          3363: ; immediate
        !          3364: : b(loop)
        !          3365: postpone loop
        !          3366: read-fcode-offset drop
        !          3367: ; immediate
        !          3368: : b(+loop)
        !          3369: postpone +loop
        !          3370: read-fcode-offset drop
        !          3371: ; immediate
        !          3372: : b(leave)
        !          3373: postpone leave
        !          3374: ; immediate
        !          3375: 0 VALUE fc-instance?
        !          3376: : fc-instance  ( -- )   \ Mark next defining word as instance-specific.
        !          3377: TRUE TO fc-instance?
1.1       root     3378: ;
1.1.1.3 ! root     3379: : new-token  \ unnamed local fcode function
        !          3380: align here next-ip read-fcode# 0 swap set-token
1.1       root     3381: ;
1.1.1.3 ! root     3382: : external-token ( -- )  \ named local fcode function
        !          3383: next-ip read-fcode-string
        !          3384: header         ( str len -- )  \ create a header in the current dictionary entry
        !          3385: new-token
        !          3386: ;
        !          3387: : new-token
        !          3388: eva-debug? IF
        !          3389: s" x" get-ip >r next-ip read-fcode# r> set-ip (u.) $cat strdup
        !          3390: header
        !          3391: THEN
        !          3392: new-token
        !          3393: ;
        !          3394: : named-token
        !          3395: fcode-debug? IF
        !          3396: external-token
1.1       root     3397: ELSE
1.1.1.3 ! root     3398: next-ip read-fcode-string 2drop       \ Forget about the name
        !          3399: new-token
1.1       root     3400: THEN
1.1.1.3 ! root     3401: ;
        !          3402: : b(to) ( val -- )
        !          3403: next-ip read-fcode#
        !          3404: get-token drop                           ( val xt )
        !          3405: dup @                                    ( val xt @xt )
        !          3406: dup <value> =  over <defer> = OR IF
        !          3407: drop
        !          3408: >body cell -
        !          3409: ?compile-mode IF
        !          3410: literal, postpone !
1.1       root     3411: ELSE
1.1.1.3 ! root     3412: !
1.1       root     3413: THEN
                   3414: ELSE
1.1.1.3 ! root     3415: <create> <> IF                         ( val xt )
        !          3416: TRUE ABORT" Invalid destination for FCODE b(to)"
1.1       root     3417: THEN
1.1.1.3 ! root     3418: dup cell+ @                           ( val xt @xt+1cell )
        !          3419: dup <instancevalue> <>  swap <instancedefer> <> AND IF
        !          3420: TRUE ABORT" Invalid destination for FCODE b(to)"
1.1       root     3421: THEN
1.1.1.3 ! root     3422: >body @                               ( val instance-offset )
        !          3423: ?compile-mode IF
        !          3424: literal,  postpone >instance  postpone !
        !          3425: ELSE
        !          3426: >instance !
1.1       root     3427: THEN
1.1.1.3 ! root     3428: ELSE
1.1       root     3429: THEN
1.1.1.3 ! root     3430: ; immediate
        !          3431: : b(value)
        !          3432: fc-instance? IF
        !          3433: <create> ,                \ Needed for "(instance?)" for example
        !          3434: <instancevalue> ,
        !          3435: (create-instance-var)
        !          3436: FALSE TO fc-instance?
1.1       root     3437: ELSE
1.1.1.3 ! root     3438: <value> , ,
1.1       root     3439: THEN
1.1.1.3 ! root     3440: reveal
1.1       root     3441: ;
1.1.1.3 ! root     3442: : b(variable)
        !          3443: fc-instance? IF
        !          3444: <create> ,                \ Needed for "(instance?)"
        !          3445: <instancevariable> ,
        !          3446: 0 (create-instance-var)
        !          3447: FALSE TO fc-instance?
1.1       root     3448: ELSE
1.1.1.3 ! root     3449: <variable> , 0 ,
1.1       root     3450: THEN
1.1.1.3 ! root     3451: reveal
        !          3452: ;
        !          3453: : b(constant)
        !          3454: <constant> , , reveal
        !          3455: ;
        !          3456: : undefined-defer
        !          3457: cr cr ." Uninitialized defer word has been executed!" cr cr
        !          3458: true fcode-end !
        !          3459: ;
        !          3460: : b(defer)
        !          3461: fc-instance? IF
        !          3462: <create> ,                \ Needed for "(instance?)"
        !          3463: <instancedefer> ,
        !          3464: ['] undefined-defer (create-instance-var)
        !          3465: reveal
        !          3466: FALSE TO fc-instance?
        !          3467: ELSE
        !          3468: <defer> , reveal
        !          3469: postpone undefined-defer
1.1       root     3470: THEN
                   3471: ;
1.1.1.3 ! root     3472: : b(create)
        !          3473: <variable> ,
        !          3474: postpone noop reveal
1.1       root     3475: ;
1.1.1.3 ! root     3476: : b(field) ( E: addr -- addr+offset ) ( F: offset size -- offset+size )
        !          3477: <colon> , over literal,
        !          3478: postpone +
        !          3479: <semicolon> compile,
        !          3480: reveal
        !          3481: +
        !          3482: ;
        !          3483: : b(buffer:) ( E: -- a-addr) ( F: size -- )
        !          3484: fc-instance? IF
        !          3485: <create> ,                \ Needed for "(instance?)"
        !          3486: <instancebuffer> ,
        !          3487: (create-instance-buf)
        !          3488: FALSE TO fc-instance?
        !          3489: ELSE
        !          3490: <buffer:> , allot
1.1       root     3491: THEN
1.1.1.3 ! root     3492: reveal
1.1       root     3493: ;
1.1.1.3 ! root     3494: : suspend-fcode ( -- )
        !          3495: noop        \ has to be implemented more efficiently ;-)
1.1       root     3496: ;
1.1.1.3 ! root     3497: : offset16 ( -- )
        !          3498: 2 to fcode-offset
1.1       root     3499: ;
1.1.1.3 ! root     3500: : version1 ( -- )
        !          3501: 1 to fcode-spread
        !          3502: 1 to fcode-offset
        !          3503: read-header
1.1       root     3504: ;
1.1.1.3 ! root     3505: : start0 ( -- )
        !          3506: 0 to fcode-spread
        !          3507: offset16
        !          3508: read-header
1.1       root     3509: ;
1.1.1.3 ! root     3510: : start1 ( -- )
        !          3511: 1 to fcode-spread
        !          3512: offset16
        !          3513: read-header
1.1       root     3514: ;
1.1.1.3 ! root     3515: : start2 ( -- )
        !          3516: 2 to fcode-spread
        !          3517: offset16
        !          3518: read-header
1.1       root     3519: ;
1.1.1.3 ! root     3520: : start4 ( -- )
        !          3521: 4 to fcode-spread
        !          3522: offset16
        !          3523: read-header
1.1       root     3524: ;
1.1.1.3 ! root     3525: : end0 ( -- )
        !          3526: true fcode-end !
1.1       root     3527: ;
1.1.1.3 ! root     3528: : end1 ( -- )
        !          3529: end0
1.1       root     3530: ;
1.1.1.3 ! root     3531: : ferror ( -- )
        !          3532: clear end0
        !          3533: cr ." FCode# " fcode-num @ . ." not assigned!"
        !          3534: cr ." FCode evaluation aborted." cr
        !          3535: ." ( -- S:" depth . ." R:" rdepth . ." ) " .s cr
        !          3536: abort
1.1       root     3537: ;
1.1.1.3 ! root     3538: : reset-local-fcodes
        !          3539: FFF 800 DO ['] ferror 0 i set-token LOOP
        !          3540: ;
        !          3541: : byte-load ( addr xt -- )
        !          3542: >r >r
        !          3543: save-evaluator-state
        !          3544: r> r>
        !          3545: reset-fcode-end
        !          3546: 1 to fcode-spread
        !          3547: dup 1 = IF drop ['] rb@ THEN to fcode-rb@
        !          3548: set-ip
        !          3549: reset-local-fcodes
        !          3550: depth >r
        !          3551: evaluate-fcode
        !          3552: r> depth 1- <> IF
        !          3553: clear end0
        !          3554: cr ." Ambiguous stack depth after byte-load!"
        !          3555: cr ." FCode evaluation aborted." cr cr
1.1       root     3556: ELSE
1.1.1.3 ! root     3557: restore-evaluator-state
1.1       root     3558: THEN
1.1.1.3 ! root     3559: ['] c@ to fcode-rb@
        !          3560: ;
        !          3561: : fc-c@   ( addr -- byte )   dup MIN-RAM-SIZE > IF rb@ ELSE c@ THEN ;
        !          3562: : fc-w@   ( addr -- word )   dup MIN-RAM-SIZE > IF rw@ ELSE w@ THEN ;
        !          3563: : fc-<w@  ( addr -- word )   fc-w@ dup 8000 >= IF 10000 - THEN ;
        !          3564: : fc-l@   ( addr -- long )   dup MIN-RAM-SIZE > IF rl@ ELSE l@ THEN ;
        !          3565: : fc-<l@  ( addr -- long )   fc-l@ signed ;
        !          3566: : fc-x@   ( addr -- dlong )  dup MIN-RAM-SIZE > IF rx@ ELSE x@ THEN ;
        !          3567: : fc-c!   ( byte addr -- )   dup MIN-RAM-SIZE > IF rb! ELSE c! THEN ;
        !          3568: : fc-w!   ( word addr -- )   dup MIN-RAM-SIZE > IF rw! ELSE w! THEN ;
        !          3569: : fc-l!   ( long addr -- )   dup MIN-RAM-SIZE > IF rl! ELSE l! THEN ;
        !          3570: : fc-x!   ( dlong addr -- )  dup MIN-RAM-SIZE > IF rx! ELSE x! THEN ;
        !          3571: : fc-fill ( add len byte -- )  2 pick MIN-RAM-SIZE > IF rfill ELSE fill THEN ;
        !          3572: : fc-move ( src dst len -- )
        !          3573: 2 pick MIN-RAM-SIZE >        \ Check src
        !          3574: 2 pick MIN-RAM-SIZE >        \ Check dst
        !          3575: OR IF rmove ELSE move THEN
        !          3576: ;
        !          3577: : free-virtual  ( virt size -- )
        !          3578: s" map-out" $call-parent
        !          3579: ;
        !          3580: : map-low  ( phys.lo ... size -- virt )
        !          3581: my-space swap s" map-in" $call-parent
        !          3582: ;
        !          3583: : mac-address  ( -- mac-str mac-len )
        !          3584: s" local-mac-address" get-my-property IF
        !          3585: 0 0
1.1       root     3586: THEN
                   3587: ;
1.1.1.3 ! root     3588: VARIABLE #line
        !          3589: 0 #line !
        !          3590: VARIABLE #out
        !          3591: 0 #out !
        !          3592: : display-status  ( n -- )
        !          3593: ." Device status: " . cr
        !          3594: ;
        !          3595: VARIABLE group-code
        !          3596: 0 group-code !
        !          3597: : dma-alloc  ( byte -- virtual )
        !          3598: s" dma-alloc" $call-parent
        !          3599: ;
        !          3600: : my-params  ( -- addr len )
        !          3601: s" params" get-my-property IF
        !          3602: 0 0
1.1       root     3603: THEN
                   3604: ;
1.1.1.3 ! root     3605: : sbus-intr>cpu  ( sbus-intr# -- cpu-intr# )
1.1       root     3606: ;
1.1.1.3 ! root     3607: : intr  ( interrupt# vector -- )
        !          3608: >r sbus-intr>cpu encode-int r> encode-int+ s" intr" property
1.1       root     3609: ;
1.1.1.3 ! root     3610: : driver  ( addr len -- )
        !          3611: encode-string s" name" property
1.1       root     3612: ;
1.1.1.3 ! root     3613: : processor-type  ( -- cpu-type )
        !          3614: 0
1.1       root     3615: ;
1.1.1.3 ! root     3616: : firmware-version  ( -- n )
        !          3617: 10000                          \ Just a dummy value
1.1       root     3618: ;
1.1.1.3 ! root     3619: : fcode-version  ( -- n )
        !          3620: fcode-revision
1.1       root     3621: ;
1.1.1.3 ! root     3622: : fc-abort ." FCode called abort: IP " get-ip . ( ." STACK: " .s ) depth dup 0< IF abort THEN . rdepth . cr  abort ;
        !          3623: : fc-0 ." 0(lit): STACK ( S: " depth . ." R: " rdepth . ." ): " depth 0> IF .s THEN 0 ;
        !          3624: : fc-1 ." 1(lit): STACK ( S: " depth . ." R: " rdepth . ." ): " depth 0> IF .s THEN 1 ;
        !          3625: : parse-1hex 1 hex-decode-unit ;
        !          3626: : fc-set-pci-mmio-tokens  ( -- )
        !          3627: ['] rw@-le  0 232 set-token
        !          3628: ['] rw!-le  0 233 set-token
        !          3629: ['] rl@-le  0 234 set-token
        !          3630: ['] rl!-le  0 235 set-token
        !          3631: ['] rx@-le  0 22E set-token
        !          3632: ['] rx!-le  0 22F set-token
        !          3633: ;
        !          3634: : fc-set-normal-mmio-tokens  ( -- )
        !          3635: ['] rw@  0 232 set-token
        !          3636: ['] rw!  0 233 set-token
        !          3637: ['] rl@  0 234 set-token
        !          3638: ['] rl!  0 235 set-token
        !          3639: ['] rx@  0 22E set-token
        !          3640: ['] rx!  0 22F set-token
1.1       root     3641: ;
1.1.1.3 ! root     3642: : reset-token-table
        !          3643: FFF 0 DO ['] ferror 0 i set-token LOOP
1.1       root     3644: ;
                   3645: reset-token-table
                   3646: ' end0 0        00 set-token
                   3647: ' b(lit)      1 10 set-token
                   3648: ' b(')        1 11 set-token
                   3649: ' b(")        1 12 set-token
                   3650: ' bbranch     1 13 set-token
                   3651: ' b?branch    1 14 set-token
                   3652: ' b(loop)     1 15 set-token
                   3653: ' b(+loop)    1 16 set-token
                   3654: ' b(do)       1 17 set-token
                   3655: ' b(?do)      1 18 set-token
                   3656: ' i           0 19 set-token
                   3657: ' j           0 1A set-token
                   3658: ' b(leave)    1 1B set-token
                   3659: ' b(of)       1 1C set-token
                   3660: ' execute     0 1D set-token
                   3661: ' +           0 1E set-token
                   3662: ' -           0 1F set-token
                   3663: ' *           0 20 set-token
                   3664: ' /           0 21 set-token
                   3665: ' mod         0 22 set-token 
                   3666: ' and         0 23 set-token 
                   3667: ' or          0 24 set-token 
                   3668: ' xor         0 25 set-token 
                   3669: ' invert      0 26 set-token 
                   3670: ' lshift      0 27 set-token 
                   3671: ' rshift      0 28 set-token 
                   3672: ' >>a         0 29 set-token 
                   3673: ' /mod        0 2A set-token 
                   3674: ' u/mod       0 2B set-token
                   3675: ' negate      0 2C set-token 
                   3676: ' abs         0 2D set-token 
                   3677: ' min         0 2E set-token 
                   3678: ' max         0 2F set-token 
                   3679: ' >r          0 30 set-token 
                   3680: ' r>          0 31 set-token 
                   3681: ' r@          0 32 set-token 
                   3682: ' exit        0 33 set-token 
                   3683: ' 0=          0 34 set-token 
                   3684: ' 0<>         0 35 set-token 
                   3685: ' 0<          0 36 set-token 
                   3686: ' 0<=         0 37 set-token 
                   3687: ' 0>          0 38 set-token 
                   3688: ' 0>=         0 39 set-token 
                   3689: ' <           0 3A set-token
                   3690: ' >           0 3B set-token
                   3691: ' =           0 3C set-token
                   3692: ' <>          0 3D set-token
                   3693: ' u>          0 3E set-token
                   3694: ' u<=         0 3F set-token 
                   3695: ' u<          0 40 set-token 
                   3696: ' u>=         0 41 set-token 
                   3697: ' >=          0 42 set-token 
                   3698: ' <=          0 43 set-token 
                   3699: ' between     0 44 set-token 
                   3700: ' within      0 45 set-token 
                   3701: ' DROP        0 46 set-token
                   3702: ' DUP         0 47 set-token
                   3703: ' OVER        0 48 set-token
                   3704: ' SWAP        0 49 set-token
                   3705: ' ROT         0 4A set-token
                   3706: ' -ROT        0 4B set-token
                   3707: ' TUCK        0 4C set-token
                   3708: ' nip         0 4D set-token 
                   3709: ' pick        0 4E set-token 
                   3710: ' roll        0 4F set-token 
                   3711: ' ?dup        0 50 set-token 
                   3712: ' depth       0 51 set-token 
                   3713: ' 2drop       0 52 set-token 
                   3714: ' 2dup        0 53 set-token 
                   3715: ' 2over       0 54 set-token 
                   3716: ' 2swap       0 55 set-token 
                   3717: ' 2rot        0 56 set-token 
                   3718: ' 2/          0 57 set-token 
                   3719: ' u2/         0 58 set-token 
                   3720: ' 2*          0 59 set-token 
                   3721: ' /c          0 5A set-token
                   3722: ' /w          0 5B set-token 
                   3723: ' /l          0 5C set-token 
                   3724: ' /n          0 5D set-token 
                   3725: ' ca+         0 5E set-token 
                   3726: ' wa+         0 5F set-token 
                   3727: ' la+         0 60 set-token 
                   3728: ' na+         0 61 set-token 
                   3729: ' char+       0 62 set-token 
                   3730: ' wa1+        0 63 set-token 
                   3731: ' la1+        0 64 set-token 
                   3732: ' cell+       0 65 set-token 
                   3733: ' chars       0 66 set-token 
                   3734: ' /w*         0 67 set-token 
                   3735: ' /l*         0 68 set-token 
                   3736: ' cells       0 69 set-token 
                   3737: ' on          0 6A set-token 
                   3738: ' off         0 6B set-token 
                   3739: ' +!          0 6C set-token 
                   3740: ' @           0 6D set-token 
1.1.1.3 ! root     3741: ' fc-l@       0 6E set-token 
        !          3742: ' fc-w@       0 6F set-token 
        !          3743: ' fc-<w@      0 70 set-token 
        !          3744: ' fc-c@       0 71 set-token 
1.1       root     3745: ' !           0 72 set-token 
1.1.1.3 ! root     3746: ' fc-l!       0 73 set-token 
        !          3747: ' fc-w!       0 74 set-token 
        !          3748: ' fc-c!       0 75 set-token 
1.1       root     3749: ' 2@          0 76 set-token 
                   3750: ' 2!          0 77 set-token 
1.1.1.3 ! root     3751: ' fc-move     0 78 set-token 
        !          3752: ' fc-fill     0 79 set-token 
1.1       root     3753: ' comp        0 7A set-token 
                   3754: ' noop        0 7B set-token
                   3755: ' lwsplit     0 7C set-token 
                   3756: ' wljoin      0 7D set-token 
                   3757: ' lbsplit     0 7E set-token 
                   3758: ' bljoin      0 7F set-token 
                   3759: ' wbflip      0 80 set-token 
                   3760: ' upc         0 81 set-token 
                   3761: ' lcc         0 82 set-token 
1.1.1.3 ! root     3762: ' pack        0 83 set-token 
1.1       root     3763: ' count       0 84 set-token 
                   3764: ' body>       0 85 set-token 
                   3765: ' >body       0 86 set-token 
                   3766: ' fcode-revision 0 87 set-token 
                   3767: ' span        0 88 set-token 
                   3768: ' unloop      0 89 set-token 
                   3769: ' expect      0 8A set-token 
1.1.1.3 ! root     3770: ' alloc-mem   0 8B set-token
        !          3771: ' free-mem    0 8C set-token
1.1       root     3772: ' key?        0 8D set-token 
                   3773: ' key         0 8E set-token 
                   3774: ' emit        0 8F set-token 
                   3775: ' type        0 90 set-token 
1.1.1.3 ! root     3776: ' (cr         0 91 set-token
1.1       root     3777: ' cr          0 92 set-token 
1.1.1.3 ! root     3778: ' #out        0 93 set-token
        !          3779: ' #line       0 94 set-token
1.1       root     3780: ' hold        0 95 set-token 
                   3781: ' <#          0 96 set-token 
                   3782: ' u#>         0 97 set-token 
                   3783: ' sign        0 98 set-token 
                   3784: ' u#          0 99 set-token 
                   3785: ' u#s         0 9A set-token 
                   3786: ' u.          0 9B set-token 
                   3787: ' u.r         0 9C set-token 
                   3788: ' .           0 9D set-token 
                   3789: ' .r          0 9E set-token 
                   3790: ' .s          0 9F set-token 
                   3791: ' base        0 A0 set-token 
                   3792: ' $number     0 A2 set-token 
                   3793: ' digit       0 A3 set-token 
                   3794: ' -1          0 A4 set-token
                   3795: '  0          0 A5 set-token
                   3796: '  1          0 A6 set-token
                   3797: '  2          0 A7 set-token
                   3798: '  3          0 A8 set-token
                   3799: ' bl          0 A9 set-token
                   3800: ' bs          0 AA set-token 
                   3801: ' bell        0 AB set-token 
                   3802: ' bounds      0 AC set-token 
                   3803: ' here        0 AD set-token 
                   3804: ' aligned     0 AE set-token 
                   3805: ' wbsplit     0 AF set-token 
                   3806: ' bwjoin      0 B0 set-token 
                   3807: ' b(<mark)    1 B1 set-token
                   3808: ' b(>resolve) 1 B2 set-token
                   3809: ' new-token   0 B5 set-token 
                   3810: ' named-token 0 B6 set-token
                   3811: ' b(:)        1 B7 set-token
                   3812: ' b(value)    1 B8 set-token 
                   3813: ' b(variable) 1 B9 set-token 
                   3814: ' b(constant) 1 BA set-token 
                   3815: ' b(create)   1 BB set-token 
                   3816: ' b(defer)    1 BC set-token 
                   3817: ' b(buffer:)  1 BD set-token 
                   3818: ' b(field)    1 BE set-token 
1.1.1.3 ! root     3819: ' fc-instance 1 C0 set-token 
1.1       root     3820: ' b(;)        1 C2 set-token
                   3821: ' b(to)       1 C3 set-token 
                   3822: ' b(case)     1 C4 set-token
                   3823: ' b(endcase)  1 C5 set-token
                   3824: ' b(endof)    1 C6 set-token
                   3825: ' #           0 C7 set-token
                   3826: ' #s          0 C8 set-token
                   3827: ' #>          0 C9 set-token
                   3828: ' external-token 0 CA set-token 
                   3829: ' $find       0 CB set-token
                   3830: ' offset16    0 CC set-token 
                   3831: ' evaluate    0 CD set-token
                   3832: ' c,          0  D0 set-token
                   3833: ' w,          0  D1 set-token
                   3834: ' l,          0  D2 set-token
                   3835: ' ,           0  D3 set-token
                   3836: ' um*         0  D4 set-token
                   3837: ' um/mod      0  D5 set-token
                   3838: ' d+          0  D8 set-token
                   3839: ' d-          0  D9 set-token
                   3840: ' get-token   0  DA set-token 
                   3841: ' set-token   0  DB set-token 
                   3842: ' state       0  DC set-token  \ possibly broken
                   3843: ' compile,    0  DD set-token
                   3844: ' behavior    0  DE set-token 
1.1.1.3 ! root     3845: ' start0            0  F0 set-token
        !          3846: ' start1            0  F1 set-token
        !          3847: ' start2            0  F2 set-token
        !          3848: ' start4            0  F3 set-token
        !          3849: ' ferror            0  FC set-token
        !          3850: ' version1          0  FD set-token
        !          3851: ' end1              0  FF set-token
        !          3852: ' dma-alloc         0 101 set-token    \ Obsolete
1.1       root     3853: ' my-address        0 102 set-token 
                   3854: ' my-space          0 103 set-token
1.1.1.3 ! root     3855: ' free-virtual      0 105 set-token
        !          3856: ' my-params         0 10f set-token    \ Obsolete
1.1       root     3857: ' property          0 110 set-token
                   3858: ' encode-int        0 111 set-token
                   3859: ' encode+           0 112 set-token
                   3860: ' encode-phys       0 113 set-token
                   3861: ' encode-string     0 114 set-token
                   3862: ' encode-bytes      0 115 set-token
                   3863: ' reg               0 116 set-token
1.1.1.3 ! root     3864: ' intr              0 117 set-token    \ Obsolete
        !          3865: ' driver            0 118 set-token    \ Obsolete
        !          3866: ' model             0 119 set-token
1.1       root     3867: ' device-type       0 11A set-token
                   3868: ' parse-2int        0 11B set-token
                   3869: ' new-device        0 11F set-token
                   3870: ' diagnostic-mode?  0 120 set-token
1.1.1.3 ! root     3871: ' display-status    0 121 set-token    \ Maybe obsolete
1.1       root     3872: ' memory-test-suite 0 122 set-token
1.1.1.3 ! root     3873: ' group-code        0 123 set-token    \ Obsolete
1.1       root     3874: ' mask              0 124 set-token
                   3875: ' get-msecs         0 125 set-token
                   3876: ' ms                0 126 set-token
                   3877: ' finish-device     0 127 set-token
                   3878: ' decode-phys       0 128 set-token
1.1.1.3 ! root     3879: ' interpose         0 12B set-token    \ Recommended practice: Interposition
        !          3880: ' map-low           0 130 set-token
        !          3881: ' sbus-intr>cpu     0 131 set-token    \ Obsolete
        !          3882: ' mac-address       0 1A4 set-token
1.1       root     3883: ' device-name       0 201 set-token
                   3884: ' my-args           0 202 set-token
                   3885: ' my-self           0 203 set-token
                   3886: ' find-package      0 204 set-token
                   3887: ' open-package      0 205 set-token
                   3888: ' close-package     0 206 set-token
                   3889: ' find-method       0 207 set-token
                   3890: ' call-package      0 208 set-token
                   3891: ' $call-parent      0 209 set-token
                   3892: ' my-parent         0 20A set-token
                   3893: ' ihandle>phandle   0 20B set-token
                   3894: ' my-unit           0 20D set-token
                   3895: ' $call-method      0 20E set-token
                   3896: ' $open-package     0 20F set-token
1.1.1.3 ! root     3897: ' processor-type    0 210 set-token       \ Obsolete
        !          3898: ' firmware-version  0 211 set-token       \ Obsolete
        !          3899: ' fcode-version     0 212 set-token       \ Obsolete
1.1       root     3900: ' (is-user-word)    0 214 set-token
                   3901: ' suspend-fcode     0 215 set-token
1.1.1.3 ! root     3902: ' fc-abort          0 216 set-token
1.1       root     3903: ' catch             0 217 set-token
                   3904: ' throw             0 218 set-token
                   3905: ' get-my-property   0 21A set-token
                   3906: ' decode-int        0 21B set-token
                   3907: ' decode-string     0 21C set-token
                   3908: ' get-inherited-property 0 21D set-token  
                   3909: ' delete-property   0 21E set-token  
                   3910: ' get-package-property 0 21F set-token
                   3911: ' cpeek             0 220 set-token 
                   3912: ' wpeek             0 221 set-token 
                   3913: ' lpeek             0 222 set-token 
                   3914: ' cpoke             0 223 set-token 
                   3915: ' wpoke             0 224 set-token 
                   3916: ' lpoke             0 225 set-token 
                   3917: ' lwflip            0 226 set-token 
                   3918: ' lbflip            0 227 set-token 
                   3919: ' lbflips           0 228 set-token
                   3920: ' rb@               0 230 set-token
                   3921: ' rb!               0 231 set-token
1.1.1.3 ! root     3922: fc-set-normal-mmio-tokens                 \ Set rw@, rw!, rl@, rl!, rx@ and rx!
1.1       root     3923: ' wbflips           0 236 set-token 
                   3924: ' lwflips           0 237 set-token 
                   3925: ' child             0 23B set-token
                   3926: ' peer              0 23C set-token
                   3927: ' next-property     0 23D set-token
                   3928: ' byte-load         0 23E set-token
                   3929: ' set-args          0 23F set-token
                   3930: ' left-parse-string 0 240 set-token
                   3931: ' bxjoin            0 241 set-token
1.1.1.3 ! root     3932: ' fc-<l@            0 242 set-token
1.1       root     3933: ' lxjoin            0 243 set-token
                   3934: ' wxjoin            0 244 set-token
                   3935: ' x,                0 245 set-token
1.1.1.3 ! root     3936: ' fc-x@             0 246 set-token
        !          3937: ' fc-x!             0 247 set-token
1.1       root     3938: ' /x                0 248 set-token
                   3939: ' /x*               0 249 set-token
                   3940: ' xa+               0 24A set-token
                   3941: ' xa1+              0 24B set-token
                   3942: ' xbflip            0 24C set-token
                   3943: ' xbflips           0 24D set-token
                   3944: ' xbsplit           0 24E set-token
                   3945: ' xlflip            0 24F set-token
                   3946: ' xlflips           0 250 set-token
                   3947: ' xlsplit           0 251 set-token
                   3948: ' xwflip            0 252 set-token
                   3949: ' xwflips           0 253 set-token
                   3950: ' xwsplit           0 254 set-token
1.1.1.3 ! root     3951: 80 cells CONSTANT LOCALS-STACK-SIZE
        !          3952: LOCALS-STACK-SIZE BUFFER: localsstackbuf
        !          3953: localsstackbuf VALUE localsstack
        !          3954: : fc-local@  ( n -- val )
        !          3955: cells localsstack swap - @
        !          3956: ;
        !          3957: : fc-local-1-@  1 fc-local@ ;
        !          3958: : fc-local-2-@  2 fc-local@ ;
        !          3959: : fc-local-3-@  3 fc-local@ ;
        !          3960: : fc-local-4-@  4 fc-local@ ;
        !          3961: : fc-local-5-@  5 fc-local@ ;
        !          3962: : fc-local-6-@  6 fc-local@ ;
        !          3963: : fc-local-7-@  7 fc-local@ ;
        !          3964: : fc-local-8-@  8 fc-local@ ;
        !          3965: : fc-local!  ( val n -- )
        !          3966: cells localsstack swap - !
        !          3967: ;
        !          3968: : fc-local-1-!  1 fc-local! ;
        !          3969: : fc-local-2-!  2 fc-local! ;
        !          3970: : fc-local-3-!  3 fc-local! ;
        !          3971: : fc-local-4-!  4 fc-local! ;
        !          3972: : fc-local-5-!  5 fc-local! ;
        !          3973: : fc-local-6-!  6 fc-local! ;
        !          3974: : fc-local-7-!  7 fc-local! ;
        !          3975: : fc-local-8-!  8 fc-local! ;
        !          3976: 0 VALUE uses-locals?
        !          3977: : (fc-push-locals)  ( ... n -- )
        !          3978: 8 cells localsstack + TO localsstack
        !          3979: localsstack localsstackbuf -
        !          3980: LOCALS-STACK-SIZE > ABORT" Locals stack exceeded!"
        !          3981: ?dup IF
        !          3982: ( ... n ) 1 swap DO
        !          3983: i fc-local!              \ Store pre-initialized locals
        !          3984: -1 +LOOP
        !          3985: THEN
        !          3986: ;
        !          3987: : fc-push-locals  ( n -- )
        !          3988: uses-locals? ABORT" Definition pushes locals multiple times!"
        !          3989: true TO uses-locals?
        !          3990: ( n ) ['] literal execute
        !          3991: ['] (fc-push-locals) compile,
        !          3992: ;
        !          3993: : fc-push-0-locals  0 fc-push-locals ;
        !          3994: : fc-push-1-locals  1 fc-push-locals ;
        !          3995: : fc-push-2-locals  2 fc-push-locals ;
        !          3996: : fc-push-3-locals  3 fc-push-locals ;
        !          3997: : fc-push-4-locals  4 fc-push-locals ;
        !          3998: : fc-push-5-locals  5 fc-push-locals ;
        !          3999: : fc-push-6-locals  6 fc-push-locals ;
        !          4000: : fc-push-7-locals  7 fc-push-locals ;
        !          4001: : fc-push-8-locals  8 fc-push-locals ;
        !          4002: : fc-pop-locals  ( -- )
        !          4003: localsstack 8 cells - TO localsstack
        !          4004: localsstack localsstackbuf - 0 < ABORT" Locals stack undeflow!"
        !          4005: ;
        !          4006: : fc-locals-exit
        !          4007: uses-locals? IF
        !          4008: ['] fc-pop-locals compile,
        !          4009: THEN
        !          4010: ['] exit compile,
        !          4011: ;
        !          4012: : fc-locals-b(;)
        !          4013: uses-locals? IF
        !          4014: ['] fc-pop-locals compile,
        !          4015: THEN
        !          4016: false TO uses-locals?
        !          4017: ['] b(;) execute
        !          4018: ;
        !          4019: : fc-set-locals-tokens  ( -- )
        !          4020: ['] fc-push-0-locals 1 407 set-token
        !          4021: ['] fc-push-1-locals 1 408 set-token
        !          4022: ['] fc-push-2-locals 1 409 set-token
        !          4023: ['] fc-push-3-locals 1 40a set-token
        !          4024: ['] fc-push-4-locals 1 40b set-token
        !          4025: ['] fc-push-5-locals 1 40c set-token
        !          4026: ['] fc-push-6-locals 1 40d set-token
        !          4027: ['] fc-push-7-locals 1 40e set-token
        !          4028: ['] fc-push-8-locals 1 40f set-token
        !          4029: ['] fc-local-1-@ 0 410 set-token
        !          4030: ['] fc-local-2-@ 0 411 set-token
        !          4031: ['] fc-local-3-@ 0 412 set-token
        !          4032: ['] fc-local-4-@ 0 413 set-token
        !          4033: ['] fc-local-5-@ 0 414 set-token
        !          4034: ['] fc-local-6-@ 0 415 set-token
        !          4035: ['] fc-local-7-@ 0 416 set-token
        !          4036: ['] fc-local-8-@ 0 417 set-token
        !          4037: ['] fc-local-1-! 0 418 set-token
        !          4038: ['] fc-local-2-! 0 419 set-token
        !          4039: ['] fc-local-3-! 0 41a set-token
        !          4040: ['] fc-local-4-! 0 41b set-token
        !          4041: ['] fc-local-5-! 0 41c set-token
        !          4042: ['] fc-local-6-! 0 41d set-token
        !          4043: ['] fc-local-7-! 0 41e set-token
        !          4044: ['] fc-local-8-! 0 41f set-token
        !          4045: ['] fc-locals-exit 1 33 set-token
        !          4046: ['] fc-locals-b(;) 1 c2 set-token
        !          4047: ;
        !          4048: fc-set-locals-tokens
        !          4049: 0 value buff
        !          4050: 0 value buff-size
        !          4051: ' read-fcode# to fcode@
        !          4052: : execute-rom-fcode ( addr len | false -- )
        !          4053: reset-fcode-end
        !          4054: ?dup IF
        !          4055: diagnostic-mode? IF ." , executing ..." cr THEN
        !          4056: dup >r r@ alloc-mem dup >r swap rmove
        !          4057: r@ set-ip evaluate-fcode
        !          4058: diagnostic-mode? IF ." Done." cr THEN
        !          4059: r> r> free-mem
        !          4060: THEN
        !          4061: ;
        !          4062: : rom-code-ignored  ( image-addr name len -- image-addr )
        !          4063: diagnostic-mode? IF
        !          4064: type ."  code found in image " dup .  ." , ignoring ..." cr
        !          4065: ELSE
        !          4066: 2drop
        !          4067: THEN
        !          4068: ;
        !          4069: : pci-find-rom ( baseaddr -- addr )
        !          4070: dup IF
        !          4071: dup rw@-le aa55 = IF
        !          4072: diagnostic-mode? IF ." Device ROM header found at " dup . cr THEN
        !          4073: ELSE
        !          4074: drop 0
        !          4075: THEN
        !          4076: THEN
        !          4077: ;
        !          4078: : pci-find-fcode ( baseaddr -- addr len | false )
        !          4079: BEGIN
        !          4080: 1ff NOT and                       \ Image must start at 512 byte boundary
        !          4081: pci-find-rom dup
        !          4082: WHILE
        !          4083: dup 18 + rw@-le +              ( pcir-addr )
        !          4084: dup rw@-le 4350 ( 'PC' ) <>    ( pcir-addr hasPC? )
        !          4085: over 2+ rw@-le 5249 ( 'IR' ) <> OR IF
        !          4086: diagnostic-mode? IF
        !          4087: ." Invalid PCI Data structure, ignoring ROM contents" cr
        !          4088: THEN
        !          4089: drop false EXIT
        !          4090: THEN                           ( pcir-addr )
        !          4091: dup 14 + rb@ CASE              \ Get image code type
        !          4092: 0 OF s" Intel x86 BIOS" rom-code-ignored ENDOF
        !          4093: 1 OF
        !          4094: diagnostic-mode? IF
        !          4095: ." Open Firmware FCode found in image at " dup . cr
        !          4096: THEN
        !          4097: dup 1ff NOT AND          \ Back to the ROM image header
        !          4098: dup 2+ rw@-le +          \ Pointer to FCODE (PCI bus binding ch.9)
        !          4099: swap 10 + rw@-le 200 *   \ Image length
        !          4100: EXIT
        !          4101: ENDOF
        !          4102: 2 OF s" HP PA RISC" rom-code-ignored ENDOF
        !          4103: 3 OF s" EFI" rom-code-ignored ENDOF
        !          4104: dup OF s" Unknown type" rom-code-ignored ENDOF
        !          4105: ENDCASE
        !          4106: dup 15 + rb@ 80 and IF         \ End of last image?
        !          4107: drop false EXIT
        !          4108: THEN
        !          4109: dup 10 + rw@-le  200 * +       \ Next image start
        !          4110: REPEAT
        !          4111: ;
        !          4112: : pci-execute-fcode  ( baseaddr -- )
        !          4113: pci-find-fcode dup 0= IF
        !          4114: 2drop EXIT
        !          4115: THEN                                 ( addr len )
        !          4116: fc-set-pci-mmio-tokens               \ Prepare PCI access functions
        !          4117: ['] execute-rom-fcode CATCH IF
        !          4118: cr ." FCODE failed!" cr
        !          4119: 2drop
        !          4120: THEN
        !          4121: fc-set-normal-mmio-tokens            \ Restore normal MMIO access functions
        !          4122: ;
        !          4123: 2e0 cp
        !          4124: 10 CONSTANT quiesce-xt#
        !          4125: CREATE quiesce-xts quiesce-xt# cells allot
        !          4126: quiesce-xts quiesce-xt# cells erase
        !          4127: : add-quiesce-xt  ( xt -- )
        !          4128: quiesce-xt# 0 DO
        !          4129: quiesce-xts I cells +    ( xt arrayptr )
        !          4130: dup @ 0=                 ( xt arrayptr true|false )
        !          4131: IF
        !          4132: ! UNLOOP EXIT
        !          4133: ELSE                     ( xt arrayptr )
        !          4134: over swap             ( xt xt arrayptr )
        !          4135: @ =                   \ xt already stored ?
        !          4136: IF
        !          4137: drop UNLOOP EXIT
        !          4138: THEN                  ( xt )
        !          4139: THEN
        !          4140: LOOP
        !          4141: drop                        ( xt -- )
        !          4142: ." Warning: quiesce xt list is full." cr
        !          4143: ;
        !          4144: : quiesce  ( -- )
        !          4145: quiesce-xt# 0 DO
        !          4146: quiesce-xts I cells +    ( arrayptr )
        !          4147: @ dup IF                 ( xt )
        !          4148: EXECUTE
        !          4149: ELSE
        !          4150: drop UNLOOP EXIT
        !          4151: THEN
        !          4152: LOOP
        !          4153: ;
        !          4154: 300 cp
        !          4155: 0 VALUE usb-debug-flag
        !          4156: false VALUE scan-time?
        !          4157: VARIABLE ihandle-bulk-tran
        !          4158: : usb-debug-print  ( str len -- )
        !          4159: usb-debug-flag  IF type cr ELSE 2drop THEN
        !          4160: ;
        !          4161: : usb-debug-print-val  ( str len val -- )
        !          4162: usb-debug-flag  IF -ROT type . cr ELSE drop 2drop THEN
        !          4163: ;
        !          4164: 0 VALUE proceed-char
        !          4165: : show-proceed ( -- )
        !          4166: scan-time?              \ are we on usb-scan ?
        !          4167: IF
        !          4168: proceed-char
        !          4169: CASE
        !          4170: 0   OF 2d ENDOF   \ show '-'
        !          4171: 1   OF 5c ENDOF   \ show '\'
        !          4172: 2   OF 7c ENDOF   \ show '|'
        !          4173: dup OF 2f ENDOF   \ show '/'
        !          4174: ENDCASE
        !          4175: emit 8 emit
        !          4176: proceed-char 1 + 3 AND to proceed-char
        !          4177: THEN
        !          4178: ;
        !          4179: : wait-proceed ( nl -- )
        !          4180: show-proceed
        !          4181: BEGIN
        !          4182: dup d# 100 >         ( nl true|false )
        !          4183: WHILE
        !          4184: 100 - show-proceed
        !          4185: 100 ms               \ do it in steps of 100ms
        !          4186: REPEAT
        !          4187: ms                      \ rest delay
        !          4188: ;
        !          4189: : do-alias-setting ( num name-str name-len )
        !          4190: rot $cathex strdup            \ create alias name
        !          4191: get-node node>path            \ get path string
        !          4192: set-alias                     \ and set the alias
        !          4193: ;
        !          4194: 0 VALUE ohci-alias-num
        !          4195: : set-ohci-alias  ( -- )
        !          4196: ohci-alias-num dup 1+ TO ohci-alias-num    ( num )
        !          4197: s" ohci"
        !          4198: do-alias-setting
        !          4199: ;
        !          4200: 0 VALUE cdrom-alias-num
        !          4201: 0 VALUE disk-alias-num        \ shall start with: pci-disk-num
        !          4202: FALSE VALUE ext-disk-alias    \ first external disk: not yet assigned
        !          4203: : set-drive-alias  ( --  )
        !          4204: space 5b emit
        !          4205: s" cdrom" drop                ( name-str )
        !          4206: get-node node>name comp 0=    ( true|false )
        !          4207: IF                            \ is this a cdrom ?
        !          4208: cdrom-alias-num dup 1+ TO cdrom-alias-num    ( num )
        !          4209: s" cdrom"                  \ yes, alias = cdrom
        !          4210: ELSE
        !          4211: s" sbc-dev" drop           \ is this a scsi-block-device?
        !          4212: get-node node>name comp 0= ( true|false )
        !          4213: IF
        !          4214: disk-alias-num dup 1 + to disk-alias-num
        !          4215: s" disk"                \ all block devices will be named "disk"
        !          4216: ext-disk-alias not   \ flag for first ext. disk already assigned
        !          4217: IF
        !          4218: TRUE to ext-disk-alias
        !          4219: 2 s" hdd"         \ add extra alias hdd2 for first USB disk
        !          4220: 2dup type 2 pick .
        !          4221: 8 emit 2f emit
        !          4222: do-alias-setting
        !          4223: THEN
        !          4224: ELSE
        !          4225: 0 s" ??? "              \ unknown device
        !          4226: THEN
        !          4227: THEN     ( num name-str name-len )
        !          4228: 2dup type 2 pick .
        !          4229: 8 emit 5d emit cr
        !          4230: do-alias-setting
        !          4231: ;
        !          4232: : usb-create-alias-name ( num -- str len )
        !          4233: >r s" ohciX" 2dup + 1-           ( str len last-char-ptr  R: num )
        !          4234: r> [char] 0 + swap c!            ( str len  R: )
        !          4235: ;
        !          4236: : ohci-scan-node  ( str len -- )
        !          4237: 2dup find-node ?dup IF
        !          4238: dup set-node
        !          4239: dup child ?dup IF
        !          4240: delete-node s" Deleting node" usb-debug-print
        !          4241: THEN
        !          4242: s" enumerate" rot find-method IF
        !          4243: drop
        !          4244: open-dev dup to my-self
        !          4245: s" enumerate" 2 pick $call-method   \ Scan host controller
        !          4246: close-dev  0 to my-self
        !          4247: 0 set-node
        !          4248: ELSE
        !          4249: 2drop get-node
        !          4250: dup parent node>path select-dev     \ Open parent
        !          4251: extend-device
        !          4252: s" usb-ohci.fs" included
        !          4253: s" open" $call-my-method 0= ABORT" OHCI open failed"
        !          4254: s" enumerate" $call-my-method
        !          4255: s" close" $call-my-method
        !          4256: finish-device
        !          4257: unselect-dev
        !          4258: THEN                             ( str len  R: num )
        !          4259: ELSE
        !          4260: 2drop
        !          4261: THEN
        !          4262: ;
        !          4263: : ohci-scan
        !          4264: space ." Scan USB... " cr
        !          4265: true to scan-time?            \ show proceeding signs
        !          4266: 0 to disk-alias-num           \ start with disk0
        !          4267: s" pci-disk-num" $find        \ previously detected disks ?
        !          4268: IF
        !          4269: execute to disk-alias-num  \ overwrite start number
        !          4270: ELSE
        !          4271: 2drop
        !          4272: THEN
        !          4273: 0 >r                             \ Counter for alias
        !          4274: BEGIN
        !          4275: r@ usb-create-alias-name
        !          4276: find-alias ?dup               ( false | str len len  R: num )
        !          4277: WHILE
        !          4278: usb-debug-flag IF
        !          4279: ." * Scanning hub " 2dup type ." ..." cr
        !          4280: THEN
        !          4281: ohci-scan-node                ( R: num )
        !          4282: r> 1+ >r                      ( R: num+1 )
        !          4283: REPEAT
        !          4284: r> drop
        !          4285: 0 TO ohci-alias-num
        !          4286: 0 TO cdrom-alias-num
        !          4287: s" cdrom0" find-alias            ( false | dev-path len )
        !          4288: dup IF
        !          4289: s" cdrom" 2swap              ( alias-name len' dev-path len )
        !          4290: set-alias                    ( -- )
        !          4291: ELSE 
        !          4292: drop                         ( -- )
        !          4293: THEN
        !          4294: false to scan-time?                 \ suppress proceeding signs
        !          4295: ;
        !          4296: : usb-scan
        !          4297: s" ohci0" find-alias IF
        !          4298: drop
        !          4299: ohci-scan
        !          4300: THEN
        !          4301: ;
        !          4302: 320 cp
        !          4303: : .ansi-attr-off 1b emit ." [0m"  ;    \ ESC Sequence: all terminal atributes off
        !          4304: : .ansi-blue     1b emit ." [34m" ;    \ ESC Sequence: foreground-color = blue
        !          4305: : .ansi-green    1b emit ." [32m" ;    \ ESC Sequence: foreground-color = green
        !          4306: : .ansi-red      1b emit ." [31m" ;    \ ESC Sequence: foreground-color = green
        !          4307: : .ansi-bold     1b emit ." [1m"  ;    \ ESC Sequence: foreground-color bold
        !          4308: false VALUE scsi-supp-present?
        !          4309: : scsi-xt-err ." SCSI-ERROR (Intern) " ;
        !          4310: ' scsi-xt-err VALUE scsi-open-xt        \ preset with an invalid token
        !          4311: : .wordlists      ( -- )
        !          4312: .ansi-red
        !          4313: get-order      ( -- wid1 .. widn n )
        !          4314: dup space 28 emit .d ." word lists : "
        !          4315: 0 DO
        !          4316: . 08 emit 2c emit
        !          4317: LOOP
        !          4318: 08 emit                 \ 'bs'
        !          4319: 29 emit                 \ ')'
        !          4320: cr space 28 emit
        !          4321: ." Context: " context dup .
        !          4322: @ 5b emit . 8 emit 5d emit
        !          4323: space
        !          4324: ." / Current: " current .
        !          4325: .ansi-attr-off
        !          4326: cr
        !          4327: ;
        !          4328: : .context  ( num -- )
        !          4329: .ansi-red
        !          4330: space
        !          4331: 5b emit
        !          4332: 23 emit . 3a emit
        !          4333: context @
        !          4334: . 8 emit 5d emit space
        !          4335: .ansi-attr-off
        !          4336: ;
        !          4337: : scsi-open  ( -- )
        !          4338: scsi-supp-present? NOT
        !          4339: IF
        !          4340: s" scsi-support.fs" included  ( xt-open )
        !          4341: to scsi-open-xt               (  )
        !          4342: true to scsi-supp-present?
        !          4343: THEN
        !          4344: scsi-open-xt execute
        !          4345: ;
        !          4346: 360 cp
        !          4347: 0 VALUE fdt-debug
        !          4348: fdt-start 0 = IF -1 throw THEN
        !          4349: struct
        !          4350: 4 field >fdth_magic
        !          4351: 4 field >fdth_tsize
        !          4352: 4 field >fdth_struct_off
        !          4353: 4 field >fdth_string_off
        !          4354: 4 field >fdth_rsvmap_off
        !          4355: 4 field >fdth_version
        !          4356: 4 field >fdth_compat_vers
        !          4357: 4 field >fdth_boot_cpu
        !          4358: 4 field >fdth_string_size
        !          4359: 4 field >fdth_struct_size
        !          4360: drop
        !          4361: h# d00dfeed constant OF_DT_HEADER
        !          4362: h#        1 constant OF_DT_BEGIN_NODE
        !          4363: h#        2 constant OF_DT_END_NODE
        !          4364: h#        3 constant OF_DT_PROP
        !          4365: h#        4 constant OF_DT_NOP
        !          4366: h#        9 constant OF_DT_END
        !          4367: fdt-start
        !          4368: dup dup >fdth_struct_off l@ + value fdt-struct
        !          4369: dup dup >fdth_string_off l@ + value fdt-strings
        !          4370: drop
        !          4371: : fdt-check-header ( -- )
        !          4372: fdt-start dup 0 = IF
        !          4373: ." No flat device tree !" cr drop -1 throw EXIT THEN
        !          4374: hex
        !          4375: fdt-debug IF
        !          4376: ." Flat device tree header at 0x" dup . s" :" type cr
        !          4377: ."  magic            : 0x" dup >fdth_magic l@ . cr
        !          4378: ."  total size       : 0x" dup >fdth_tsize l@ . cr
        !          4379: ."  offset to struct : 0x" dup >fdth_struct_off l@ . cr
        !          4380: ."  offset to strings: 0x" dup >fdth_string_off l@ . cr
        !          4381: ."  offset to rsvmap : 0x" dup >fdth_rsvmap_off l@ . cr
        !          4382: ."  version          : " dup >fdth_version l@ decimal . hex cr
        !          4383: ."  last compat vers : " dup >fdth_compat_vers l@ decimal . hex cr
        !          4384: dup >fdth_version l@ 2 >= IF
        !          4385: ."  boot CPU         : 0x" dup >fdth_boot_cpu l@ . cr
        !          4386: THEN
        !          4387: dup >fdth_version l@ 3 >= IF
        !          4388: ."  strings size     : 0x" dup >fdth_string_size l@ . cr
        !          4389: THEN
        !          4390: dup >fdth_version l@ 17 >= IF
        !          4391: ."  struct size      : 0x" dup >fdth_struct_size l@ . cr
        !          4392: THEN
        !          4393: THEN
        !          4394: dup >fdth_magic l@ OF_DT_HEADER <> IF
        !          4395: ." Flat device tree has incorrect magic value !" cr
        !          4396: drop -1 throw EXIT
        !          4397: THEN
        !          4398: dup >fdth_version l@ 10 < IF
        !          4399: ." Flat device tree has usupported version !" cr
        !          4400: drop -1 throw EXIT
        !          4401: THEN
        !          4402: drop
        !          4403: ;
        !          4404: fdt-check-header
        !          4405: : fdt-next-tag ( addr -- nextaddr tag )
        !          4406: 0                              ( dummy tag on stack for loop )
        !          4407: BEGIN
        !          4408: drop                   ( drop previous tag )
        !          4409: dup l@                 ( read new tag )
        !          4410: swap 4 + swap          ( increment addr )
        !          4411: dup OF_DT_NOP <> UNTIL         ( loop until not nop )
        !          4412: ;
        !          4413: : fdt-fetch-unit ( addr -- addr $name )
        !          4414: dup from-cstring              \  get string size
        !          4415: 2dup + 1 + 3 + fffffffc and -rot
        !          4416: ;
        !          4417: : fdt-reg-unit ( prop-addr prop-len -- )
        !          4418: s" #address-cells" get-parent get-package-property IF
        !          4419: 2drop
        !          4420: ELSE
        !          4421: decode-int nip nip        ( prop-addr prop-len #addr-cells )
        !          4422: 3 <> IF
        !          4423: 2drop EXIT
        !          4424: THEN
        !          4425: decode-phys               ( prop-addr' prop-len' phys.lo ... phys.hi )
        !          4426: set-unit                  ( prop-addr' prop-len' )
        !          4427: 2drop
        !          4428: THEN
        !          4429: ;
        !          4430: : fdt-fetch-string ( index -- str-addr str-len )  
        !          4431: fdt-strings + dup from-cstring
        !          4432: ;
        !          4433: : fdt-create-dec  s" decode-unit" $CREATE , DOES> @ hex-decode-unit ;
        !          4434: : fdt-create-enc  s" encode-unit" $CREATE , DOES> @ hex-encode-unit ;
        !          4435: : fdt-prop-is-string?  ( addr len -- string? )
        !          4436: dup 1 < IF 2drop FALSE EXIT THEN                \ Check for valid length
        !          4437: 1-
        !          4438: 2dup + c@ 0<> IF 2drop FALSE EXIT THEN          \ Check zero-termination
        !          4439: test-string
        !          4440: ;
        !          4441: : fdt-encode-prop  ( addr len -- )
        !          4442: 2dup fdt-prop-is-string? IF
        !          4443: 1- encode-string
        !          4444: ELSE
        !          4445: encode-bytes
        !          4446: THEN
        !          4447: ;
        !          4448: : fdt-unflatten-node ( start -- end )
        !          4449: recursive
        !          4450: fdt-next-tag dup OF_DT_BEGIN_NODE <> IF
        !          4451: s" Weird tag 0x" type . " at start of node" type cr
        !          4452: -1 throw
        !          4453: THEN drop
        !          4454: new-device
        !          4455: fdt-fetch-unit
        !          4456: dup 0 = IF drop drop " /" THEN
        !          4457: 40 left-parse-string
        !          4458: device-name
        !          4459: dup IF
        !          4460: " #address-cells" get-parent get-package-property IF
        !          4461: 2drop
        !          4462: ELSE
        !          4463: decode-int nip nip
        !          4464: hex-decode-unit
        !          4465: set-unit
        !          4466: THEN
        !          4467: ELSE 2drop THEN
        !          4468: BEGIN
        !          4469: fdt-next-tag dup OF_DT_END_NODE <>
        !          4470: WHILE
        !          4471: dup OF_DT_PROP = IF
        !          4472: drop dup                       ( drop tag, dup addr     : a1 a1 )
        !          4473: dup l@ dup rot 4 +     ( fetch size, stack is   : a1 s s a2)
        !          4474: dup l@ swap 4 +                ( fetch nameid, stack is : a1 s s i a3 )
        !          4475: rot                    ( we now have: a1 s i a3 s )
        !          4476: fdt-encode-prop rot    ( a1 s pa ps i)
        !          4477: fdt-fetch-string               ( a1 s pa ps na ns )
        !          4478: 2dup s" reg" str= IF
        !          4479: 2swap 2dup fdt-reg-unit 2swap
        !          4480: THEN
        !          4481: property
        !          4482: + 8 + 3 + fffffffc and
        !          4483: ELSE dup OF_DT_BEGIN_NODE = IF
        !          4484: drop                   ( drop tag )
        !          4485: 4 -
        !          4486: fdt-unflatten-node
        !          4487: ELSE
        !          4488: drop -1 throw
        !          4489: THEN THEN
        !          4490: REPEAT drop \ drop tag
        !          4491: " #address-cells" get-node get-package-property IF ELSE
        !          4492: decode-int dup fdt-create-dec fdt-create-enc 2drop
        !          4493: THEN
        !          4494: finish-device  
        !          4495: ;
        !          4496: : fdt-unflatten-tree
        !          4497: fdt-debug IF
        !          4498: ." Unflattening device tree..." cr THEN
        !          4499: fdt-struct fdt-unflatten-node drop
        !          4500: fdt-debug IF
        !          4501: ." Done !" cr THEN
        !          4502: ;
        !          4503: fdt-unflatten-tree
        !          4504: : fdt-parse-memory
        !          4505: " /memory" find-device
        !          4506: " reg" get-node get-package-property IF throw -1 THEN
        !          4507: decode-phys 2drop decode-phys
        !          4508: my-#address-cells 1 > IF 20 << or THEN
        !          4509: fdt-debug IF
        !          4510: dup ." Memory size: " . cr
        !          4511: THEN
        !          4512: MIN-RAM-SIZE swap MIN-RAM-SIZE - release
        !          4513: 2drop device-end
        !          4514: ;
        !          4515: fdt-parse-memory
        !          4516: : fdt-claim-reserve
        !          4517: fdt-start
        !          4518: dup dup >fdth_tsize l@ 0 claim drop
        !          4519: dup >fdth_rsvmap_off l@ +
        !          4520: BEGIN
        !          4521: dup dup x@ swap 8 + x@
        !          4522: dup 0 <>
        !          4523: WHILE
        !          4524: fdt-debug IF
        !          4525: 2dup swap ." Reserve map entry: " . ." : " . cr
        !          4526: THEN
        !          4527: 0 claim drop
        !          4528: 10 +
        !          4529: REPEAT drop drop drop
        !          4530: ;
        !          4531: fdt-claim-reserve 
        !          4532: 0 VALUE (fdt-phandle-replaced)
        !          4533: : fdt-replace-interrupt-map  ( old new prop-addr prop-len -- old new )
        !          4534: BEGIN
        !          4535: dup                    ( old new prop-addr prop-len prop-len )
        !          4536: WHILE
        !          4537: swap dup 10 +          ( old new prop-len prop-addr prop-addr+10 )
        !          4538: dup l@ 5 pick = IF
        !          4539: 3 pick swap l!
        !          4540: TRUE TO (fdt-phandle-replaced)
        !          4541: ELSE
        !          4542: drop
        !          4543: THEN
        !          4544: 1c + swap 1c -
        !          4545: REPEAT
        !          4546: 2drop
        !          4547: ;
        !          4548: : fdt-replace-all-phandles ( old new node -- )
        !          4549: >r
        !          4550: s" interrupt-map" r@ get-property 0= IF
        !          4551: fdt-replace-interrupt-map
        !          4552: THEN
        !          4553: s" interrupt-parent" r@ get-property 0= IF
        !          4554: decode-int -rot 2drop                  ( old new val  R: node )
        !          4555: 2 pick = IF                            ( old new      R: node )
        !          4556: dup encode-int s" interrupt-parent" r@ set-property
        !          4557: TRUE TO (fdt-phandle-replaced)
        !          4558: THEN
        !          4559: THEN
        !          4560: r>
        !          4561: child BEGIN
        !          4562: dup
        !          4563: WHILE
        !          4564: 3dup RECURSE
        !          4565: PEER
        !          4566: REPEAT
        !          4567: 3drop
        !          4568: ;
        !          4569: : fdt-fix-node-phandle  ( node -- )
        !          4570: >r
        !          4571: FALSE TO (fdt-phandle-replaced)
        !          4572: s" phandle" r@ get-property 0= IF
        !          4573: decode-int                       ( p-addr2 p-len2 val )
        !          4574: r@ s" /" find-node               ( p-addr2 p-len2 val node root )  
        !          4575: fdt-replace-all-phandles         ( p-addr2 p-len2 )
        !          4576: 2drop
        !          4577: (fdt-phandle-replaced) IF
        !          4578: r@ set-node
        !          4579: s" phandle" delete-property
        !          4580: s" linux,phandle" delete-property
        !          4581: ELSE
        !          4582: diagnostic-mode? IF
        !          4583: cr ." Warning: Did not replace phandle in " r@ node>path type cr
        !          4584: THEN
        !          4585: THEN
        !          4586: THEN
        !          4587: r> drop
        !          4588: ;
        !          4589: : fdt-fix-phandles  ( node -- )
        !          4590: dup fdt-fix-node-phandle
        !          4591: child BEGIN
        !          4592: dup
        !          4593: WHILE
        !          4594: dup RECURSE
        !          4595: PEER
        !          4596: REPEAT
        !          4597: drop
        !          4598: device-end
        !          4599: ;
        !          4600: s" /" find-node fdt-fix-phandles
        !          4601: defer (client-exec)
        !          4602: defer client-exec
        !          4603: defer callback
        !          4604: defer continue-client
        !          4605: : set-chosen ( prop len name len -- )
        !          4606: s" /chosen" find-node set-property ;
        !          4607: : get-chosen ( name len -- [ prop len ] success )
        !          4608: s" /chosen" find-node get-property 0= ;
        !          4609: " /" find-device
        !          4610: new-device
        !          4611: s" aliases" device-name
        !          4612: finish-device
        !          4613: new-device
        !          4614: s" options" device-name
        !          4615: finish-device
        !          4616: new-device
        !          4617: s" openprom" device-name
        !          4618: s" BootROM" device-type
        !          4619: finish-device
        !          4620: new-device 
        !          4621: s" packages" device-name
        !          4622: get-node to packages
        !          4623: new-device
        !          4624: s" deblocker" device-name
        !          4625: INSTANCE VARIABLE offset
        !          4626: INSTANCE VARIABLE block-size
        !          4627: INSTANCE VARIABLE max-transfer
        !          4628: INSTANCE VARIABLE my-block
        !          4629: INSTANCE VARIABLE adr
        !          4630: INSTANCE VARIABLE len
        !          4631: : open
        !          4632: s" block-size" ['] $call-parent CATCH IF 2drop false EXIT THEN
        !          4633: block-size !
        !          4634: s" max-transfer" ['] $call-parent CATCH IF 2drop false EXIT THEN
        !          4635: max-transfer !
        !          4636: block-size @ alloc-mem my-block !
        !          4637: 0 offset !
        !          4638: true ;
        !          4639: : close  my-block @ block-size @ free-mem ;
        !          4640: : seek ( lo hi -- status ) \ XXX: perhaps we should fail if the underlying
        !          4641: lxjoin offset !  0 ;
        !          4642: : block+remainder ( -- block# remainder )  offset @ block-size @ u/mod swap ;
        !          4643: : read-blocks ( addr block# #blocks -- actual )  s" read-blocks" $call-parent ;
        !          4644: : read ( addr len -- actual )
        !          4645: dup >r  len ! adr !
        !          4646: block+remainder dup IF ( block# offset-in-block )
        !          4647: >r my-block @ swap 1 read-blocks drop
        !          4648: my-block @ r@ + adr @ block-size @ r> - len @ min dup >r move
        !          4649: r> dup negate len +! dup adr +! offset +! ELSE 2drop THEN
        !          4650: BEGIN len @ block-size @ >= WHILE
        !          4651: adr @ block+remainder drop len @ max-transfer @ min block-size @ / read-blocks
        !          4652: block-size @ * dup negate len +! dup adr +! offset +! REPEAT
        !          4653: len @ IF my-block @ block+remainder drop 1 read-blocks drop
        !          4654: my-block @ adr @ len @ move THEN
        !          4655: r> ;
        !          4656: finish-device
        !          4657: new-device
        !          4658: false VALUE debug-disk-label?
        !          4659: d# 16384 value max-prep-partition-blocks
        !          4660: s" disk-label" device-name
        !          4661: 0 INSTANCE VALUE partition
        !          4662: 0 INSTANCE VALUE part-offset
        !          4663: 0 INSTANCE VALUE part-start
        !          4664: 0 INSTANCE VALUE lpart-start
        !          4665: 0 INSTANCE VALUE part-size
        !          4666: 0 INSTANCE VALUE dos-logical-partitions
        !          4667: 0 INSTANCE VALUE block-size
        !          4668: 0 INSTANCE VALUE block
        !          4669: 0 INSTANCE VALUE args
        !          4670: 0 INSTANCE VALUE args-len
        !          4671: INSTANCE VARIABLE block#  \ variable to store logical sector#
        !          4672: INSTANCE VARIABLE hit#    \ partition counter
        !          4673: INSTANCE VARIABLE success-flag
        !          4674: 0ff constant END-OF-DESC
        !          4675: 3 constant  PARTITION-ID
        !          4676: 48 constant VOL-PART-LOC
        !          4677: STRUCT
        !          4678: 1b8 field mbr>boot-loader
        !          4679: /l field mbr>disk-signature
        !          4680: /w field mbr>null
        !          4681: 40 field mbr>partition-table
        !          4682: /w field mbr>magic
        !          4683: CONSTANT /mbr
        !          4684: STRUCT
        !          4685: /c field part-entry>active
        !          4686: /c field part-entry>start-head
        !          4687: /c field part-entry>start-sect
        !          4688: /c field part-entry>start-cyl
        !          4689: /c field part-entry>id
        !          4690: /c field part-entry>end-head
        !          4691: /c field part-entry>end-sect
        !          4692: /c field part-entry>end-cyl
        !          4693: /l field part-entry>sector-offset
        !          4694: /l field part-entry>sector-count
        !          4695: CONSTANT /partition-entry
        !          4696: : offset ( d.rel -- d.abs )
        !          4697: part-offset xlsplit d+
        !          4698: ;
        !          4699: : seek  ( pos.lo pos.hi -- status )
        !          4700: offset
        !          4701: debug-disk-label? IF 2dup ." seek-parent: pos.hi=0x" u. ." pos.lo=0x" u. THEN
        !          4702: s" seek" $call-parent
        !          4703: debug-disk-label? IF dup ." status=" . cr THEN
        !          4704: ;
        !          4705: : read ( addr len -- actual )
        !          4706: debug-disk-label? IF 2dup swap ." read-parent: addr=0x" u. ." len=" .d THEN
        !          4707: s" read" $call-parent
        !          4708: debug-disk-label? IF dup ." actual=" .d cr THEN
        !          4709: ;
        !          4710: : read-sector ( sector-number -- )
        !          4711: block-size * 0 seek drop      \ seek to sector
        !          4712: block block-size read drop    \ read sector
        !          4713: ;
        !          4714: : (.part-entry) ( part-entry )
        !          4715: cr ." part-entry>active:        " dup part-entry>active c@ .d
        !          4716: cr ." part-entry>start-head:    " dup part-entry>start-head c@ .d
        !          4717: cr ." part-entry>start-sect:    " dup part-entry>start-sect c@ .d
        !          4718: cr ." part-entry>start-cyl:     " dup part-entry>start-cyl  c@ .d
        !          4719: cr ." part-entry>id:            " dup part-entry>id c@ .d
        !          4720: cr ." part-entry>end-head:      " dup part-entry>end-head c@ .d
        !          4721: cr ." part-entry>end-sect:      " dup part-entry>end-sect c@ .d
        !          4722: cr ." part-entry>end-cyl:       " dup part-entry>end-cyl c@ .d
        !          4723: cr ." part-entry>sector-offset: " dup part-entry>sector-offset l@-le .d
        !          4724: cr ." part-entry>sector-count:  " dup part-entry>sector-count l@-le .d
        !          4725: cr
        !          4726: ;
        !          4727: : (.name) r@ begin cell - dup @ <colon> = UNTIL xt>name cr type space ;
        !          4728: : init-block ( -- )
        !          4729: s" block-size" ['] $call-parent CATCH IF ABORT" parent has no block-size." THEN
        !          4730: to block-size
        !          4731: d# 2048 alloc-mem
        !          4732: dup d# 2048 erase
        !          4733: to block
        !          4734: debug-disk-label? IF
        !          4735: ." init-block: block-size=" block-size .d ." block=0x" block u. cr
        !          4736: THEN
        !          4737: ;
        !          4738: : no-mbr? ( -- true|false )
        !          4739: 0 read-sector block mbr>magic w@-le aa55 <>
        !          4740: ;
        !          4741: : pc-extended-partition? ( part-entry-addr -- true|false )
        !          4742: part-entry>id c@      ( id )
        !          4743: dup 5 = swap          ( true|false id )
        !          4744: dup f = swap          ( true|false true|false id )
        !          4745: 85 =                  ( true|false true|false true|false )
        !          4746: or or                 ( true|false )
        !          4747: ;
        !          4748: : partition>part-entry ( partition -- part-entry )
        !          4749: 1- /partition-entry * block mbr>partition-table +
        !          4750: ;
        !          4751: : partition>start-sector ( partition -- sector-offset )
        !          4752: partition>part-entry part-entry>sector-offset l@-le
        !          4753: ;
        !          4754: : count-dos-logical-partitions ( -- #logical-partitions )
        !          4755: no-mbr? IF 0 EXIT THEN
        !          4756: 0 5 1 DO                                ( current )
        !          4757: i partition>part-entry               ( current part-entry )
        !          4758: dup pc-extended-partition? IF
        !          4759: part-entry>sector-offset l@-le    ( current sector )
        !          4760: dup to part-start to lpart-start  ( current )
        !          4761: BEGIN
        !          4762: part-start read-sector          \ read EBR
        !          4763: 1 partition>start-sector IF
        !          4764: 1+
        !          4765: THEN \ another logical partition
        !          4766: 2 partition>start-sector
        !          4767: ?dup IF lpart-start + to part-start false ELSE true THEN
        !          4768: UNTIL
        !          4769: ELSE
        !          4770: drop
        !          4771: THEN
        !          4772: LOOP
        !          4773: ;
        !          4774: : (get-dos-partition-params) ( ext-part-start part-entry -- offset count active? id )
        !          4775: dup part-entry>sector-offset l@-le rot + swap ( offset part-entry )
        !          4776: dup part-entry>sector-count l@-le swap        ( offset count part-entry )
        !          4777: dup part-entry>active c@ 80 = swap            ( offset count active? part-entry )
        !          4778: part-entry>id c@                              ( offset count active? id )
        !          4779: ;
        !          4780: : find-dos-partition ( partition# -- false | offset count active? id true )
        !          4781: to partition 0 to part-start 0 to part-offset
        !          4782: partition 0<= IF 0 to partition false EXIT THEN
        !          4783: no-mbr? IF 0 to partition false EXIT THEN
        !          4784: partition 4 <= IF \ Is this a primary partition?
        !          4785: 0 partition partition>part-entry
        !          4786: (get-dos-partition-params)
        !          4787: true EXIT
        !          4788: ELSE
        !          4789: partition 4 - 0 5 1 DO                      ( logical-partition current )
        !          4790: i partition>part-entry                   ( log-part current part-entry )
        !          4791: dup pc-extended-partition? IF
        !          4792: part-entry>sector-offset l@-le        ( log-part current sector )
        !          4793: dup to part-start to lpart-start      ( log-part current )
        !          4794: BEGIN
        !          4795: part-start read-sector             \ read EBR
        !          4796: 1 partition>start-sector IF        \ first partition entry
        !          4797: 1+ 2dup = IF                    ( log-part current )
        !          4798: 2drop
        !          4799: part-start 1 partition>part-entry
        !          4800: (get-dos-partition-params)
        !          4801: true UNLOOP EXIT
        !          4802: THEN
        !          4803: 2 partition>start-sector
        !          4804: ?dup IF lpart-start + to part-start false ELSE true THEN
        !          4805: ELSE
        !          4806: true
        !          4807: THEN
        !          4808: UNTIL
        !          4809: ELSE
        !          4810: drop
        !          4811: THEN
        !          4812: LOOP
        !          4813: 2drop false
        !          4814: THEN
        !          4815: ;
        !          4816: : try-dos-partition ( -- okay? )
        !          4817: no-mbr? IF cr ." No DOS disk-label found." cr false EXIT THEN
        !          4818: count-dos-logical-partitions TO dos-logical-partitions
        !          4819: debug-disk-label? IF
        !          4820: ." Found " dos-logical-partitions .d ." logical partitions" cr
        !          4821: ." Partition = " partition .d cr
        !          4822: THEN
        !          4823: partition 1 5 dos-logical-partitions +
        !          4824: within 0= IF
        !          4825: cr ." Partition # not 1-" 4 dos-logical-partitions + . cr false EXIT
        !          4826: THEN
        !          4827: partition find-dos-partition IF
        !          4828: 2drop
        !          4829: to part-size
        !          4830: block-size * to part-offset
        !          4831: true
        !          4832: ELSE
        !          4833: false
        !          4834: THEN
        !          4835: ;
        !          4836: : has-iso9660-filesystem  ( -- TRUE|FALSE )
        !          4837: 10 800 * 0 seek drop      \ seek to sector
        !          4838: block 800 read drop       \ read sector
        !          4839: block c@ 1 =
        !          4840: block 1+ 5 s" CD001"  str=
        !          4841: and
        !          4842: dup IF 800 to block-size THEN
        !          4843: ;
        !          4844: : load-from-dos-boot-partition ( addr -- size )
        !          4845: no-mbr? IF FALSE EXIT THEN  \ read MBR and check for DOS disk-label magic
        !          4846: count-dos-logical-partitions TO dos-logical-partitions
        !          4847: debug-disk-label? IF
        !          4848: ." Found " dos-logical-partitions .d ." logical partitions" cr
        !          4849: ." Partition = " partition .d cr
        !          4850: THEN
        !          4851: 5 dos-logical-partitions + 1 DO
        !          4852: i find-dos-partition IF        ( addr offset count active? id )
        !          4853: 41 = and                    ( addr offset count prep-boot-part? )
        !          4854: IF                          ( addr offset count )
        !          4855: max-prep-partition-blocks min  \ reduce load size
        !          4856: swap                     ( addr count offset )
        !          4857: block-size * to part-offset
        !          4858: 0 0 seek drop            ( addr offset )
        !          4859: block-size * read        ( size )
        !          4860: UNLOOP EXIT
        !          4861: ELSE
        !          4862: 2drop                    ( addr )
        !          4863: THEN
        !          4864: THEN
        !          4865: LOOP
        !          4866: drop 0
        !          4867: ;
        !          4868: : load-from-boot-partition ( addr -- size )
        !          4869: load-from-dos-boot-partition
        !          4870: ;
        !          4871: : parse-bootinfo-txt  ( addr len -- str len )
        !          4872: 2dup s" <boot-script>" find-substr       ( addr len pos1 )
        !          4873: 2dup = IF
        !          4874: 3drop 0 0 EXIT
        !          4875: THEN
        !          4876: dup >r - swap r> + swap                  ( addr1 len1 )
        !          4877: 2dup [char] \ findchar drop              ( addr1 len1 pos2 )
        !          4878: dup >r - swap r> + swap                  ( addr2 len2 )
        !          4879: 2dup s" </boot-script>" find-substr nip  ( addr2 len3 )
        !          4880: ;
        !          4881: : load-chrp-boot-file ( addr -- size )
        !          4882: my-self parent ihandle>phandle node>path
        !          4883: s" :\ppc\bootinfo.txt" $cat strdup       ( addr str len )
        !          4884: open-dev dup 0= IF 2drop 0 EXIT THEN
        !          4885: >r dup                                   ( addr addr R:ihandle )
        !          4886: dup s" load" r@ $call-method             ( addr addr size R:ihandle )
        !          4887: r> close-dev                             ( addr addr size )
        !          4888: parse-bootinfo-txt                       ( addr fnstr fnlen )
        !          4889: dup 0= IF 3drop 0 EXIT THEN
        !          4890: my-self parent ihandle>phandle node>path ( addr fnstr fnlen nstr nlen )
        !          4891: s" :" $cat 2swap $cat strdup             ( addr str len )
        !          4892: 2dup encode-string s" bootpath" set-chosen
        !          4893: open-dev dup 0= IF ." failed to load CHRP boot loader." 2drop 0 EXIT THEN
        !          4894: >r s" load" r@ $call-method              ( size R:ihandle )
        !          4895: r> close-dev                             ( size )
        !          4896: ;
        !          4897: : parse-partition ( -- okay? )
        !          4898: 0 to partition
        !          4899: 0 to part-offset
        !          4900: 0 to part-size
        !          4901: my-args to args-len to args
        !          4902: debug-disk-label? IF
        !          4903: cr ." disk-label parse-partition: my-args=" my-args type cr
        !          4904: THEN
        !          4905: args-len 0 = IF true EXIT THEN
        !          4906: my-args [char] , findchar 0= IF \ no comma?
        !          4907: args c@ isdigit not IF       \ ... and not a partition number?
        !          4908: true EXIT                 \ ... then it's not a partition we can parse
        !          4909: THEN
        !          4910: ELSE
        !          4911: drop
        !          4912: THEN
        !          4913: my-args [char] , split to args-len to args
        !          4914: dup 0= IF 2drop true EXIT THEN \ no first argument
        !          4915: base @ >r decimal $number r> base !
        !          4916: IF cr ." Not a partition #" false EXIT THEN
        !          4917: to partition
        !          4918: true
        !          4919: ;
        !          4920: : (interpose-filesystem) ( str len -- )
        !          4921: find-package IF args args-len rot interpose THEN
        !          4922: ;
        !          4923: : try-dos-files ( -- found? )
        !          4924: no-mbr? IF false EXIT THEN
        !          4925: block c@ e9 <> IF
        !          4926: block c@ eb <>
        !          4927: block 2+ c@ 90 <> or
        !          4928: IF false EXIT THEN
        !          4929: THEN
        !          4930: s" fat-files" (interpose-filesystem)
        !          4931: true
        !          4932: ;
        !          4933: : try-ext2-files ( -- found? )
        !          4934: 2 read-sector               \ read first superblock
        !          4935: block d# 56 + w@-le         \ fetch s_magic
        !          4936: ef53 <> IF false EXIT THEN  \ s_magic found?
        !          4937: s" ext2-files" (interpose-filesystem)
        !          4938: true
        !          4939: ;
        !          4940: : try-iso9660-files
        !          4941: has-iso9660-filesystem 0= IF false exit THEN
        !          4942: s" iso-9660" (interpose-filesystem)
        !          4943: true
        !          4944: ;
        !          4945: : try-files ( -- found? )
        !          4946: args-len 0= IF true EXIT THEN
        !          4947: try-dos-files IF true EXIT THEN
        !          4948: try-ext2-files IF true EXIT THEN
        !          4949: try-iso9660-files IF true EXIT THEN
        !          4950: false
        !          4951: ;
        !          4952: : try-partitions ( -- found? )
        !          4953: try-dos-partition IF try-files EXIT THEN
        !          4954: false
        !          4955: ;
        !          4956: : close ( -- )
        !          4957: debug-disk-label? IF ." Closing disk-label: block=0x" block u. ." block-size=" block-size .d cr THEN
        !          4958: block d# 2048 free-mem
        !          4959: ;
        !          4960: : open ( -- true|false )
        !          4961: init-block
        !          4962: parse-partition 0= IF
        !          4963: close
        !          4964: false EXIT
        !          4965: THEN
        !          4966: partition IF
        !          4967: try-partitions
        !          4968: ELSE
        !          4969: try-files
        !          4970: THEN
        !          4971: dup 0= IF debug-disk-label? IF ." not found." cr THEN close THEN \ free memory again
        !          4972: ;
        !          4973: : load ( addr -- size )
        !          4974: debug-disk-label? IF
        !          4975: ." load: " dup u. cr
        !          4976: THEN
        !          4977: args-len IF
        !          4978: TRUE ABORT" Load done w/o filesystem"
        !          4979: ELSE
        !          4980: partition IF
        !          4981: 0 0 seek drop
        !          4982: part-size IF
        !          4983: part-size max-prep-partition-blocks min   \ Load size
        !          4984: ELSE
        !          4985: max-prep-partition-blocks
        !          4986: THEN
        !          4987: 200 *  read
        !          4988: ELSE
        !          4989: has-iso9660-filesystem IF
        !          4990: dup load-chrp-boot-file ?dup 0 > IF nip EXIT THEN
        !          4991: THEN
        !          4992: load-from-boot-partition
        !          4993: dup 0= ABORT" No boot partition found"
        !          4994: THEN
        !          4995: THEN
        !          4996: ;
        !          4997: finish-device
        !          4998: new-device
        !          4999: s" fat-files" device-name
        !          5000: INSTANCE VARIABLE bytes/sector
        !          5001: INSTANCE VARIABLE sectors/cluster
        !          5002: INSTANCE VARIABLE #reserved-sectors
        !          5003: INSTANCE VARIABLE #fats
        !          5004: INSTANCE VARIABLE #root-entries
        !          5005: INSTANCE VARIABLE total-#sectors
        !          5006: INSTANCE VARIABLE media-descriptor
        !          5007: INSTANCE VARIABLE sectors/fat
        !          5008: INSTANCE VARIABLE sectors/track
        !          5009: INSTANCE VARIABLE #heads
        !          5010: INSTANCE VARIABLE #hidden-sectors
        !          5011: INSTANCE VARIABLE fat-type
        !          5012: INSTANCE VARIABLE bytes/cluster
        !          5013: INSTANCE VARIABLE fat-offset
        !          5014: INSTANCE VARIABLE root-offset
        !          5015: INSTANCE VARIABLE cluster-offset
        !          5016: INSTANCE VARIABLE #clusters
        !          5017: : seek  s" seek" $call-parent ;
        !          5018: : read  s" read" $call-parent ;
        !          5019: INSTANCE VARIABLE data
        !          5020: INSTANCE VARIABLE #data
        !          5021: : free-data
        !          5022: data @ ?dup IF #data @ free-mem  0 data ! THEN ;
        !          5023: : read-data ( offset size -- )
        !          5024: free-data  dup #data ! alloc-mem data !
        !          5025: xlsplit seek            -2 and ABORT" fat-files read-data: seek failed"
        !          5026: data @ #data @ read #data @ <> ABORT" fat-files read-data: read failed" ;
        !          5027: CREATE fat-buf 8 allot
        !          5028: : read-fat ( cluster# -- data )
        !          5029: fat-buf 8 erase
        !          5030: 1 #split fat-type @ * 2/ 2/ fat-offset @ +
        !          5031: xlsplit seek -2 and ABORT" fat-files read-fat: seek failed"
        !          5032: fat-buf 8 read 8 <> ABORT" fat-files read-fat: read failed"
        !          5033: fat-buf 8c@ bxjoin fat-type @ dup >r 2* #split drop r> #split
        !          5034: rot IF swap THEN drop ;
        !          5035: INSTANCE VARIABLE next-cluster
        !          5036: : read-cluster ( cluster# -- )
        !          5037: dup bytes/cluster @ * cluster-offset @ + bytes/cluster @ read-data
        !          5038: read-fat dup #clusters @ >= IF drop 0 THEN next-cluster ! ;
        !          5039: : read-dir ( cluster# -- )
        !          5040: ?dup 0= IF root-offset @ #root-entries @ 20 * read-data 0 next-cluster !
        !          5041: ELSE read-cluster THEN ;
        !          5042: : .time ( x -- )
        !          5043: base @ >r decimal
        !          5044: b #split 2 0.r [char] : emit  5 #split 2 0.r [char] : emit  2* 2 0.r
        !          5045: r> base ! ;
        !          5046: : .date ( x -- )
        !          5047: base @ >r decimal
        !          5048: 9 #split 7bc + 4 0.r [char] - emit  5 #split 2 0.r [char] - emit  2 0.r
        !          5049: r> base ! ;
        !          5050: : .attr ( attr -- )
        !          5051: 6 0 DO dup 1 and IF s" RHSLDA" drop i + c@ ELSE bl THEN emit u2/ LOOP drop ;
        !          5052: : .dir-entry ( adr -- )
        !          5053: dup 0b + c@ 8 and IF drop EXIT THEN \ volume label, not a file
        !          5054: dup c@ e5 = IF drop EXIT THEN \ deleted file
        !          5055: cr
        !          5056: dup 1a + 2c@ bwjoin [char] # emit 4 0.r space \ starting cluster
        !          5057: dup 18 + 2c@ bwjoin .date space
        !          5058: dup 16 + 2c@ bwjoin .time space
        !          5059: dup 1c + 4c@ bljoin base @ decimal swap a .r base ! space \ size in bytes
        !          5060: dup 0b + c@ .attr space
        !          5061: dup 8 BEGIN 2dup 1- + c@ 20 = over and WHILE 1- REPEAT type
        !          5062: dup 8 + 3 BEGIN 2dup 1- + c@ 20 = over and WHILE 1- REPEAT dup IF
        !          5063: [char] . emit type ELSE 2drop THEN
        !          5064: drop ;
        !          5065: : .dir-entries ( adr n -- )
        !          5066: 0 ?DO dup i 20 * + dup c@ 0= IF drop LEAVE THEN .dir-entry LOOP drop ;
        !          5067: : .dir ( cluster# -- )
        !          5068: read-dir BEGIN data @ #data @ 20 / .dir-entries next-cluster @ WHILE
        !          5069: next-cluster @ read-cluster REPEAT ;
        !          5070: : str-upper ( str len adr -- ) \ Copy string to adr, uppercase
        !          5071: -rot bounds ?DO i c@ upc over c! char+ LOOP drop ;
        !          5072: CREATE dos-name b allot
        !          5073: : make-dos-name ( str len -- )
        !          5074: dos-name b bl fill
        !          5075: 2dup [char] . findchar IF
        !          5076: 3dup 1+ /string 3 min dos-name 8 + str-upper nip THEN
        !          5077: 8 min dos-name str-upper ;
        !          5078: : (find-file) ( -- cluster file-len is-dir? true | false )
        !          5079: data @ BEGIN dup data @ #data @ + < WHILE
        !          5080: dup dos-name b comp WHILE 20 + REPEAT
        !          5081: dup 1a + 2c@ bwjoin swap dup 1c + 4c@ bljoin swap 0b + c@ 10 and 0<> true
        !          5082: ELSE drop false THEN ;
        !          5083: : find-file ( dir-cluster name len -- cluster file-len is-dir? true | false )
        !          5084: make-dos-name read-dir BEGIN (find-file) 0= WHILE next-cluster @ WHILE
        !          5085: next-cluster @ read-cluster REPEAT false ELSE true THEN ;
        !          5086: : find-path ( dir-cluster name len -- cluster file-len true | false )
        !          5087: dup 0= IF 3drop false ."  empty name " EXIT THEN
        !          5088: over c@ [char] \ = IF 1 /string ."  slash " RECURSE EXIT THEN
        !          5089: [char] \ split 2>r find-file 0= IF 2r> 2drop false ."  not found " EXIT THEN
        !          5090: r@ 0<> <> IF 2drop 2r> 2drop false ."  no dir<->file match " EXIT THEN
        !          5091: r@ 0<> IF drop 2r> ."  more... " RECURSE EXIT THEN
        !          5092: 2r> 2drop true ."  got it " ;
        !          5093: : do-super ( -- )
        !          5094: 0 200 read-data
        !          5095: data @ 0b + 2c@ bwjoin bytes/sector !
        !          5096: data @ 0d + c@ sectors/cluster !
        !          5097: bytes/sector @ sectors/cluster @ * bytes/cluster !
        !          5098: data @ 0e + 2c@ bwjoin #reserved-sectors !
        !          5099: data @ 10 + c@ #fats !
        !          5100: data @ 11 + 2c@ bwjoin #root-entries !
        !          5101: data @ 13 + 2c@ bwjoin total-#sectors !
        !          5102: data @ 15 + c@ media-descriptor !
        !          5103: data @ 16 + 2c@ bwjoin sectors/fat !
        !          5104: data @ 18 + 2c@ bwjoin sectors/track !
        !          5105: data @ 1a + 2c@ bwjoin #heads !
        !          5106: data @ 1c + 2c@ bwjoin #hidden-sectors !
        !          5107: total-#sectors @ 0= IF data @ 20 + 4c@ bljoin total-#sectors ! THEN
        !          5108: sectors/fat @ 0= IF data @ 24 + 4c@ bljoin sectors/fat ! THEN
        !          5109: total-#sectors @ #reserved-sectors @ - sectors/fat @ #fats @ * -
        !          5110: #root-entries @ 20 * bytes/sector @ // - sectors/cluster @ /
        !          5111: dup #clusters !
        !          5112: dup ff5 < IF drop c ELSE fff5 < IF 10 ELSE 20 THEN THEN fat-type !
        !          5113: cr ." FAT" base @ decimal fat-type @ . base !
        !          5114: #reserved-sectors @ bytes/sector @ * fat-offset !
        !          5115: #fats @ sectors/fat @ * bytes/sector @ * fat-offset @ + root-offset !
        !          5116: #root-entries @ 20 * bytes/sector @ tuck // * root-offset @ +
        !          5117: bytes/cluster @ 2* - cluster-offset ! ;
        !          5118: INSTANCE VARIABLE file-cluster
        !          5119: INSTANCE VARIABLE file-len
        !          5120: INSTANCE VARIABLE current-pos
        !          5121: INSTANCE VARIABLE pos-in-data
        !          5122: : seek ( lo hi -- status )
        !          5123: lxjoin dup current-pos ! file-cluster @ read-cluster
        !          5124: BEGIN dup #data @ >= WHILE #data @ - next-cluster @ dup 0= IF
        !          5125: 2drop true EXIT THEN read-cluster REPEAT pos-in-data ! false ;
        !          5126: : read ( adr len -- actual )
        !          5127: file-len @ current-pos @ - min \ can't go past end of file
        !          5128: #data @ pos-in-data @ - min >r \ length for this transfer
        !          5129: data @ pos-in-data @ + swap r@ move \ move the data
        !          5130: r@ pos-in-data +!  r@ current-pos +!  pos-in-data @ #data @ = IF
        !          5131: next-cluster @ ?dup IF read-cluster 0 pos-in-data ! THEN THEN r> ;
        !          5132: : read ( adr len -- actual )
        !          5133: dup >r BEGIN dup WHILE 2dup read dup 0= ABORT" fat-files: read failed"
        !          5134: /string ( tuck - >r + r> ) REPEAT 2drop r> ;
        !          5135: : load ( adr -- len )
        !          5136: file-len @ read dup file-len @ <> ABORT" fat-files: failed loading file" ;
        !          5137: : close  free-data ;
        !          5138: : open
        !          5139: do-super
        !          5140: 0 my-args find-path 0= IF close false EXIT THEN
        !          5141: file-len !  file-cluster !  0 0 seek 0= ;
        !          5142: finish-device
        !          5143: new-device
        !          5144: s" rom-files" device-name
        !          5145: INSTANCE VARIABLE length
        !          5146: INSTANCE VARIABLE next-file
        !          5147: INSTANCE VARIABLE buffer
        !          5148: INSTANCE VARIABLE buffer-size
        !          5149: INSTANCE VARIABLE file
        !          5150: INSTANCE VARIABLE file-size
        !          5151: INSTANCE VARIABLE found
        !          5152: : open  true 
        !          5153: 100 dup buffer-size ! alloc-mem buffer ! false found ! ;
        !          5154: : close buffer @ buffer-size @ free-mem ;
        !          5155: : read ( addr len -- actual ) s" read" $call-parent ;
        !          5156: : seek ( lo hi -- status ) s" seek" $call-parent ;
        !          5157: : .read-file-name ( offset -- str len )
        !          5158: 0 seek drop 
        !          5159: buffer @ buffer-size @ read drop
        !          5160: buffer-size @ 1 - buffer @ + 0 swap c!
        !          5161: buffer @ zcount ;
        !          5162: : .print-info ( offset -- )
        !          5163: dup 2 spaces 6 0.r 2 spaces dup
        !          5164: 8 + 0 seek drop length 8 read drop
        !          5165: 6 length @ swap 0.r 2 spaces
        !          5166: 20 + .read-file-name type cr ;
        !          5167: : .list-header cr
        !          5168: s" --offset---size-----file-name----" type cr ;
        !          5169: : list
        !          5170: .list-header
        !          5171: 0 0 BEGIN + dup 
        !          5172: .print-info dup 0 seek drop
        !          5173: next-file 8 read drop next-file @
        !          5174: dup 0= UNTIL 2drop ;
        !          5175: : (find-file)  ( name len -- offset | -1 )
        !          5176: 0 0 seek drop false found !
        !          5177: file-size ! file ! 0 0 BEGIN + dup
        !          5178: 20 + .read-file-name file @ file-size @
        !          5179: str= IF true found ! THEN
        !          5180: dup 0 seek drop
        !          5181: next-file 8 read drop next-file @
        !          5182: dup 0= found @ or UNTIL drop found @ 0=
        !          5183: IF drop -1 THEN ;
        !          5184: : load  ( addr -- size )
        !          5185: my-parent instance>args 2@ [char] \ left-parse-string 2drop
        !          5186: (find-file) dup -1 = IF 2drop 0 ELSE
        !          5187: 0 0 seek drop
        !          5188: dup 8 + 0 seek drop
        !          5189: here 8 read drop here @  ( dest-addr offset file-size )
        !          5190: over 18 + 0 seek drop
        !          5191: here 8 read drop here @  ( dest-addr offset file-size data-offset )
        !          5192: rot + 0 seek drop  ( dest-addr file-size )
        !          5193: read 
        !          5194: THEN
        !          5195: ;
        !          5196: finish-device
        !          5197: new-device
        !          5198: s" ext2-files" device-name
        !          5199: INSTANCE VARIABLE first-block
        !          5200: INSTANCE VARIABLE inode-size
        !          5201: INSTANCE VARIABLE block-size
        !          5202: INSTANCE VARIABLE inodes/group
        !          5203: INSTANCE VARIABLE group-desc-size
        !          5204: INSTANCE VARIABLE group-descriptors
        !          5205: : seek  s" seek" $call-parent ;
        !          5206: : read  s" read" $call-parent ;
        !          5207: INSTANCE VARIABLE data
        !          5208: INSTANCE VARIABLE #data
        !          5209: INSTANCE VARIABLE indirect-block
        !          5210: INSTANCE VARIABLE dindirect-block
        !          5211: : free-data
        !          5212: data @ ?dup IF #data @ free-mem  0 data ! THEN ;
        !          5213: : read-data ( offset size -- )
        !          5214: free-data  dup #data ! alloc-mem data !
        !          5215: xlsplit seek            -2 and ABORT" ext2-files read-data: seek failed"
        !          5216: data @ #data @ read #data @ <> ABORT" ext2-files read-data: read failed" ;
        !          5217: : read-block ( block# -- )
        !          5218: block-size @ * block-size @ read-data ;
        !          5219: INSTANCE VARIABLE inode
        !          5220: INSTANCE VARIABLE file-len
        !          5221: INSTANCE VARIABLE blocks
        !          5222: INSTANCE VARIABLE #blocks
        !          5223: INSTANCE VARIABLE ^blocks
        !          5224: INSTANCE VARIABLE #blocks-left
        !          5225: : blocks-read ( n -- )  dup negate #blocks-left +! 4 * ^blocks +! ;
        !          5226: : read-indirect-blocks ( indirect-block# -- )
        !          5227: read-block data @ data off
        !          5228: dup #blocks-left @ 4 * block-size @ min dup >r ^blocks @ swap move
        !          5229: r> 2 rshift blocks-read block-size @ free-mem ;
        !          5230: : read-double-indirect-blocks ( double-indirect-block# -- )
        !          5231: read-block data @ indirect-block ! data off
        !          5232: BEGIN
        !          5233: indirect-block @ l@-le dup 0 <>
        !          5234: WHILE
        !          5235: read-indirect-blocks
        !          5236: 4 indirect-block +!       \ point to next indirect block
        !          5237: REPEAT
        !          5238: drop                         \ drop 0, the invalid block number
        !          5239: ;
        !          5240: : read-triple-indirect-blocks ( triple-indirect-block# -- )
        !          5241: read-block data @ dindirect-block ! data off
        !          5242: BEGIN
        !          5243: dindirect-block @ l@-le dup 0 <>
        !          5244: WHILE
        !          5245: read-double-indirect-blocks
        !          5246: 4 dindirect-block +!      \ point to next double indirect block
        !          5247: REPEAT
        !          5248: drop                         \ drop 0, the invalid block number
        !          5249: ;
        !          5250: : read-block#s ( -- )
        !          5251: blocks @ ?dup IF #blocks @ 4 * free-mem THEN
        !          5252: inode @ 4 + l@-le file-len !
        !          5253: file-len @ block-size @ // #blocks !
        !          5254: #blocks @ 4 * alloc-mem blocks !
        !          5255: blocks @ ^blocks !  #blocks @ #blocks-left !
        !          5256: #blocks-left @ c min \ # direct blocks
        !          5257: inode @ 28 + over 4 * ^blocks @ swap move blocks-read
        !          5258: #blocks-left @ IF inode @ 58 + l@-le read-indirect-blocks THEN
        !          5259: #blocks-left @ IF inode @ 5c + l@-le read-double-indirect-blocks THEN
        !          5260: #blocks-left @ IF inode @ 60 + l@-le read-triple-indirect-blocks THEN ;
        !          5261: : read-inode ( inode# -- )
        !          5262: 1- inodes/group @ u/mod \ # in group, group #
        !          5263: 20 * group-descriptors @ + 8 + l@-le block-size @ * \ # in group, inode table
        !          5264: swap inode-size @ * + xlsplit seek drop  inode @ inode-size @ read drop
        !          5265: ;
        !          5266: : .rwx ( bits last-char-if-special special? -- )
        !          5267: rot dup 4 and IF ." r" ELSE ." -" THEN
        !          5268: dup 2 and IF ." w" ELSE ." -" THEN
        !          5269: swap IF 1 and 0= IF upc THEN emit ELSE
        !          5270: 1 and IF ." x" ELSE ." -" THEN drop THEN ;
        !          5271: CREATE mode-chars 10 allot s" ?pc?d?b?-?l?s???" mode-chars swap move
        !          5272: : .mode ( mode -- )
        !          5273: dup c rshift f and mode-chars + c@ emit
        !          5274: dup 6 rshift 7 and over 800 and 73 swap .rwx
        !          5275: dup 3 rshift 7 and over 400 and 73 swap .rwx
        !          5276: dup          7 and swap 200 and 74 swap .rwx ;
        !          5277: : .inode ( -- )
        !          5278: base @ >r decimal
        !          5279: inode @      w@-le .mode \ file mode
        !          5280: inode @ 1a + w@-le 5 .r \ link count
        !          5281: inode @ 02 + w@-le 9 .r \ uid
        !          5282: inode @ 18 + w@-le 9 .r \ gid
        !          5283: inode @ 04 + l@-le 9 .r \ size
        !          5284: r> base ! ;
        !          5285: : do-super ( -- )
        !          5286: 400 400 read-data
        !          5287: data @ 14 + l@-le first-block !
        !          5288: 400 data @ 18 + l@-le lshift block-size !
        !          5289: data @ 28 + l@-le inodes/group !
        !          5290: data @ 4c + l@-le 0= IF
        !          5291: 80 inode-size !
        !          5292: ELSE
        !          5293: data @ 58 + w@-le inode-size !
        !          5294: THEN
        !          5295: data @ 20 + l@-le group-desc-size !
        !          5296: first-block @ 1+ block-size @ *
        !          5297: group-desc-size @
        !          5298: read-data
        !          5299: data @ group-descriptors !
        !          5300: data off
        !          5301: ;
        !          5302: INSTANCE VARIABLE current-pos
        !          5303: : read ( adr len -- actual )
        !          5304: file-len @ current-pos @ - min \ can't go past end of file
        !          5305: current-pos @ block-size @ u/mod 4 * blocks @ + l@-le read-block
        !          5306: block-size @ over - rot min >r ( adr off r: len )
        !          5307: data @ + swap r@ move r> dup current-pos +! ;
        !          5308: : read ( adr len -- actual )
        !          5309: dup >r BEGIN dup WHILE 2dup read dup 0= ABORT" ext2-files: read failed"
        !          5310: /string REPEAT 2drop r> ;
        !          5311: : seek ( lo hi -- status )
        !          5312: lxjoin dup file-len @ > IF drop true EXIT THEN current-pos ! false ;
        !          5313: : load ( adr -- len )
        !          5314: file-len @ read dup file-len @ <> ABORT" ext2-files: failed loading file" ;
        !          5315: : .name ( adr -- )  dup 8 + swap 6 + c@ type ;
        !          5316: : read-dir ( inode# -- adr )
        !          5317: read-inode read-block#s file-len @ alloc-mem
        !          5318: 0 0 seek ABORT" ext2-files read-dir: seek failed"
        !          5319: dup file-len @ read file-len @ <> ABORT" ext2-files read-dir: read failed" ;
        !          5320: : .dir ( inode# -- )
        !          5321: read-dir dup BEGIN 2dup file-len @ - > over l@-le tuck and WHILE
        !          5322: cr dup 8 0.r space read-inode .inode space space dup .name
        !          5323: dup 4 + w@-le + REPEAT 2drop file-len @ free-mem ;
        !          5324: : (find-file) ( adr name len -- inode#|0 )
        !          5325: 2>r dup BEGIN 2dup file-len @ - > over l@-le and WHILE
        !          5326: dup 8 + over 6 + c@ 2r@ str= IF 2r> 2drop nip l@-le EXIT THEN
        !          5327: dup 4 + w@-le + REPEAT 2drop 2r> 2drop 0 ;
        !          5328: : find-file ( inode# name len -- inode#|0 )
        !          5329: 2>r read-dir dup 2r> (find-file) swap file-len @ free-mem ;
        !          5330: : find-path ( inode# name len -- inode#|0 )
        !          5331: dup 0= IF 3drop 0 ."  empty name " EXIT THEN
        !          5332: over c@ [char] \ = IF 1 /string ."  slash " RECURSE EXIT THEN
        !          5333: [char] \ split 2>r find-file ?dup 0= IF
        !          5334: 2r> 2drop false ."  not found " EXIT THEN
        !          5335: r@ 0<> IF 2r> ."  more... " RECURSE EXIT THEN
        !          5336: 2r> 2drop ."  got it " ;
        !          5337: : close
        !          5338: inode @ inode-size @ free-mem
        !          5339: group-descriptors @ group-desc-size @ free-mem
        !          5340: free-data
        !          5341: blocks @ ?dup IF #blocks @ 4 * free-mem THEN
        !          5342: ;
        !          5343: : open
        !          5344: 0 data ! 0 blocks ! 0 #blocks !
        !          5345: do-super
        !          5346: inode-size @ alloc-mem inode !
        !          5347: my-args nip 0= IF 0 0 ELSE
        !          5348: 2 my-args find-path ?dup 0= IF close false EXIT THEN THEN
        !          5349: read-inode read-block#s 0 0 seek 0= ;
        !          5350: finish-device
        !          5351: new-device
        !          5352: s" obp-tftp" device-name
        !          5353: INSTANCE VARIABLE ciregs-buffer
        !          5354: : open ( -- okay? ) 
        !          5355: ciregs-size alloc-mem ciregs-buffer ! 
        !          5356: true
        !          5357: ;
        !          5358: : load ( addr -- size )
        !          5359: ciregs ciregs-buffer @ ciregs-size move
        !          5360: s" bootargs" get-chosen 0= IF 0 0 THEN >r >r
        !          5361: s" bootpath" get-chosen 0= IF 0 0 THEN >r >r
        !          5362: my-parent ihandle>phandle node>path encode-string
        !          5363: s" bootpath" set-chosen
        !          5364: (u.) s" netboot " 2swap $cat s"  60000000 " $cat
        !          5365: 6B8 alloc-mem dup >r (u.) $cat s"  " $cat
        !          5366: huge-tftp-load @ IF s"  1 " ELSE s"  0 " THEN $cat
        !          5367: s" 1432 " $cat
        !          5368: my-args $cat
        !          5369: (client-exec) dup 0< IF drop 0 THEN
        !          5370: ciregs-buffer @ ciregs ciregs-size move
        !          5371: r>
        !          5372: r> r> over IF s" bootpath" set-chosen ELSE 2drop THEN
        !          5373: r> r> over IF s" bootargs" set-chosen ELSE 2drop THEN
        !          5374: dup 6B8 encode-bytes s" bootp-response" s" /chosen" find-node set-property
        !          5375: 6B8 free-mem
        !          5376: ;
        !          5377: : close ( -- )
        !          5378: ciregs-buffer @ ciregs-size free-mem 
        !          5379: ;
        !          5380: : ping  ( -- )
        !          5381: s" ping " my-args $cat (client-exec)
        !          5382: ;
        !          5383: finish-device
        !          5384: new-device
        !          5385: s" iso-9660" device-name
        !          5386: 0 VALUE iso-debug-flag
        !          5387: : iso-debug-print ( str len -- )  iso-debug-flag IF type cr ELSE 2drop THEN  ;
        !          5388: 0 VALUE  path-tbl-size
        !          5389: 0 VALUE  path-tbl-addr
        !          5390: 0 VALUE  root-dir-size
        !          5391: 0 VALUE  vol-size
        !          5392: 0 VALUE  logical-blk-size
        !          5393: 0 VALUE  path-table
        !          5394: 0 VALUE  count
        !          5395: INSTANCE VARIABLE dir-addr
        !          5396: INSTANCE VARIABLE data-buff
        !          5397: INSTANCE VARIABLE #data
        !          5398: INSTANCE VARIABLE ptable
        !          5399: INSTANCE VARIABLE file-loc
        !          5400: INSTANCE VARIABLE file-size
        !          5401: INSTANCE VARIABLE cur-file-offset
        !          5402: INSTANCE VARIABLE self
        !          5403: INSTANCE VARIABLE index
        !          5404: : seek  ( pos.lo pos.hi -- status )  s" seek" $call-parent  ;
        !          5405: : read  ( addr len -- actual )  s" read" $call-parent  ;
        !          5406: : free-data ( -- )
        !          5407: data-buff @                              ( data-buff )
        !          5408: ?DUP  IF  #data @  free-mem  0 data-buff ! THEN
        !          5409: ;
        !          5410: : read-data ( offset size -- )
        !          5411: free-data  DUP                     ( offset size size )
        !          5412: #data !  alloc-mem   data-buff !   (  offset )
        !          5413: xlsplit                            ( pos.lo pos.hi )
        !          5414: seek   -2 and ABORT" seek failed."
        !          5415: data-buff  @  #data @  read        ( actual )
        !          5416: #data @  <> ABORT" read failed."
        !          5417: ;
        !          5418: : extract-vol-info  (  --  )
        !          5419: 10  800 * 800 read-data
        !          5420: data-buff @  88  + l@-be  to path-tbl-size   \ read path table size
        !          5421: data-buff @  94  + l@-be  to path-tbl-addr   \ read big-endian  path table
        !          5422: data-buff @  a2  + l@-be   dir-addr !        \ gather of root directory info
        !          5423: data-buff @  0aa + l@-be  to root-dir-size   \ get volume info
        !          5424: data-buff @  54  + l@-be  to vol-size        \ size in blocks
        !          5425: data-buff @  82  + l@-be  to logical-blk-size
        !          5426: path-tbl-size alloc-mem dup  TO path-table path-tbl-size erase
        !          5427: path-tbl-addr 800 *  xlsplit seek  drop
        !          5428: path-table  path-tbl-size  read  drop     \ pathtable in-system-memory copy
        !          5429: ;
        !          5430: : file-name  ( str len --  str' len' )
        !          5431: 2dup  [char] ; findchar  IF
        !          5432: nip                 \ Omit the trailing ";1" revision of ISO9660 file name
        !          5433: 2dup + 1-           ( str newlen endptr )
        !          5434: c@ [CHAR] . = IF
        !          5435: 1-               ( str len' )    \ Remove trailing dot
        !          5436: THEN
        !          5437: THEN
        !          5438: ;
        !          5439: : dup3  ( num  -- num num num ) dup dup dup  ;
        !          5440: : get-next-record  ( rec-addr -- next-rec-offset )
        !          5441: dup3               ( rec-addr rec-addr rec-addr rec-addr )
        !          5442: self @ 1 +  self ! ( rec-addr rec-addr rec-addr rec-addr )
        !          5443: c@  1 AND  IF      ( rec-addr rec-addr rec-addr )
        !          5444: c@ +  9         ( rec-addr rec-addr' rec-len )
        !          5445: ELSE
        !          5446: c@ +  8         ( rec-addr rec-addr' rec-len )
        !          5447: THEN
        !          5448: + swap  -          ( next-rec-offset )
        !          5449: ;
        !          5450: : path-table-search ( str len -- TRUE | FALSE )
        !          5451: path-table path-tbl-size +  path-table ptable @ +  DO ( str len )
        !          5452: 2dup  I 6 + w@-be index @ =                        ( str len str len )
        !          5453: -rot  I 8 +  I c@  string=ci and  IF               ( str len )
        !          5454: s" Directory Matched!!  "   iso-debug-print     ( str len )
        !          5455: self @   index !                                ( str len )
        !          5456: I 2 + l@-be   dir-addr ! I  dup                 ( str len rec-addr )
        !          5457: get-next-record + path-table -   ptable !       ( str len )
        !          5458: 2drop  TRUE UNLOOP EXIT                         ( TRUE )
        !          5459: THEN
        !          5460: I get-next-record                           ( str len next-rec-offset )
        !          5461: +LOOP
        !          5462: 2drop
        !          5463: FALSE                                          ( FALSE )
        !          5464: s" Invalid path / directory "  iso-debug-print
        !          5465: ;
        !          5466: : search-file-dir ( str len  -- TRUE | FALSE )
        !          5467: dir-addr @  800 *  dir-addr !             ( str len )
        !          5468: dir-addr @ 100 read-data                  ( str len )
        !          5469: data-buff @  0e + l@-be  dup >r           ( str len rec-len )
        !          5470: 100 >  IF                                 ( str len )
        !          5471: s" size dir record"  iso-debug-print   ( str len )
        !          5472: dir-addr @ r@  read-data               ( str len )
        !          5473: THEN
        !          5474: r> data-buff @  + data-buff @  DO         ( str len )
        !          5475: I 19 + c@  2 and 0=  IF                ( str len )
        !          5476: 2dup                                ( str len  str len )
        !          5477: I 21 + I 20 + c@                    ( str len  str len  str' len' )
        !          5478: file-name  string=ci  IF            ( str len )
        !          5479: s" File found!"  iso-debug-print ( str len )
        !          5480: I 6 + l@-be 800 *                ( str len file-loc )
        !          5481: file-loc !                       ( str len )
        !          5482: I 0e + l@-be  file-size !        ( str len )
        !          5483: 2drop
        !          5484: TRUE                             ( TRUE )
        !          5485: UNLOOP
        !          5486: EXIT
        !          5487: THEN
        !          5488: THEN
        !          5489: I c@ dup 0=  IF                        ( str len len )
        !          5490: s" file not found"   iso-debug-print
        !          5491: drop  2drop FALSE                   ( FALSE )
        !          5492: UNLOOP
        !          5493: EXIT
        !          5494: THEN
        !          5495: +LOOP
        !          5496: 2drop
        !          5497: FALSE                                     ( FALSE )
        !          5498: s" file not found"   iso-debug-print
        !          5499: ;
        !          5500: : search-path ( str len -- FALSE|TRUE )
        !          5501: 0  ptable !
        !          5502: 1  self !
        !          5503: 1  index !
        !          5504: dup                                             ( str len len )
        !          5505: 0=  IF
        !          5506: 3drop FALSE                                  ( FALSE )
        !          5507: s"  Empty path name "  iso-debug-print  EXIT ( FALSE )
        !          5508: THEN
        !          5509: OVER c@                                         ( str len char )
        !          5510: [char] \ =  IF                                  ( str len )
        !          5511: swap 1 + swap 1 -  BEGIN                     ( str len )
        !          5512: [char] \  split                           ( str len  str' len ' )
        !          5513: dup 0 =   IF                              ( str len  str' len ' )
        !          5514: 2drop search-file-dir EXIT             ( TRUE | FALSE )
        !          5515: ELSE
        !          5516: 2swap path-table-search  invert  IF    ( str' len ' )
        !          5517: 2drop FALSE  EXIT                   ( FALSE )
        !          5518: THEN
        !          5519: THEN
        !          5520: AGAIN
        !          5521: ELSE   BEGIN
        !          5522: [char] \  split   dup 0 =   IF               ( str len str' len' )
        !          5523: 2drop search-file-dir EXIT                ( TRUE | FALSE )
        !          5524: ELSE
        !          5525: 2swap path-table-search  invert  IF       ( str' len ' )
        !          5526: 2drop FALSE  EXIT                      ( FALSE )
        !          5527: THEN
        !          5528: THEN
        !          5529: AGAIN
        !          5530: THEN
        !          5531: ;
        !          5532: 0 VALUE loc
        !          5533: : load ( addr -- len )
        !          5534: dup to loc                     ( addr )
        !          5535: file-loc @  xlsplit seek drop
        !          5536: file-size @  read              ( file-size )
        !          5537: iso-debug-flag IF s" Bytes returned from read:" type dup . cr THEN
        !          5538: dup file-size @  <> ABORT" read failed!"
        !          5539: ;
        !          5540: : close ( -- )
        !          5541: free-data   count 1 - dup to count  0 =  IF
        !          5542: path-table path-tbl-size free-mem
        !          5543: 0 TO path-table
        !          5544: THEN
        !          5545: ;
        !          5546: : open ( -- TRUE | FALSE )
        !          5547: 0 data-buff !
        !          5548: 0 #data !
        !          5549: 0 ptable !
        !          5550: 0 file-loc !
        !          5551: 0 file-size !
        !          5552: 0 cur-file-offset !
        !          5553: 1 self !
        !          5554: 1 index !
        !          5555: count 0 =  IF
        !          5556: s" extract-vol-info called "   iso-debug-print
        !          5557: extract-vol-info
        !          5558: THEN
        !          5559: count  1 + to count
        !          5560: my-args search-path  IF
        !          5561: file-loc @  xlsplit seek drop
        !          5562: TRUE    ( TRUE )
        !          5563: ELSE
        !          5564: close
        !          5565: FALSE   ( FALSE )
        !          5566: THEN
        !          5567: 0 cur-file-offset !
        !          5568: s" opened ISO9660 package" iso-debug-print
        !          5569: ;
        !          5570: : seek ( pos.lo pos.hi -- status )
        !          5571: lxjoin dup  cur-file-offset !  ( offset )
        !          5572: file-loc @  + xlsplit          ( pos.lo pos.hi )
        !          5573: s" seek" $call-parent          ( status )
        !          5574: ;
        !          5575: : read ( addr len -- actual )
        !          5576: file-size @ cur-file-offset @ -             ( addr len remainder-of-file )
        !          5577: min                                         ( addr len|remainder-of-file )
        !          5578: s" read" $call-parent                       ( actual )
        !          5579: dup cur-file-offset @ +  cur-file-offset !  ( actual )
        !          5580: cur-file-offset @                           ( offset actual )
        !          5581: xlsplit seek drop                           ( actual )
        !          5582: ;
        !          5583: finish-device
        !          5584: new-device
        !          5585: s" bulk" device-name
        !          5586: : open  true  ;
        !          5587: : close ;
        !          5588: 8 chars alloc-mem VALUE setup-packet
        !          5589: 0 VALUE cbw-addr
        !          5590: : build-cbw ( address tag transfer-len direction lun command-len -- )
        !          5591: 5 pick TO cbw-addr  ( address tag transfer-len direction lun command-len )
        !          5592: cbw-addr 0f erase   ( address tag transfer-len direction lun command-len )
        !          5593: cbw-addr e + c!     ( address tag transfer-len direction lun )
        !          5594: cbw-addr d + c!     ( address tag transfer-len direction )
        !          5595: cbw-addr c + c!     ( address tag transfer-len )
        !          5596: cbw-addr 8 + l!-le  ( address tag )
        !          5597: cbw-addr 4 + l!-le  ( address )
        !          5598: 43425355 cbw-addr l!-le ( address )
        !          5599: drop  ;
        !          5600: 0 VALUE csw-addr
        !          5601: : analyze-csw ( address -- residue tag true|reason false )
        !          5602: TO csw-addr
        !          5603: csw-addr l@-le 53425355 =  IF
        !          5604: csw-addr c + c@ dup 0=  IF ( reason )
        !          5605: drop
        !          5606: csw-addr 8 + l@-le ( residue )
        !          5607: csw-addr 4 + l@-le ( residue tag ) \ command  block tag
        !          5608: TRUE               ( residue tag TRUE )
        !          5609: ELSE
        !          5610: FALSE              ( reason FALSE )
        !          5611: THEN
        !          5612: ELSE
        !          5613: FALSE                 ( FALSE )
        !          5614: THEN
        !          5615: csw-addr 0c erase
        !          5616: ;
        !          5617: : bulk-reset-recovery-procedure ( bulk-out-endp bulk-in-endp usb-addr -- )
        !          5618: s" bulk-reset-recovery-procedure" $call-parent
        !          5619: ;
        !          5620: finish-device
        !          5621: finish-device
        !          5622: : open true ;
        !          5623: : close ;
        !          5624: device-end
        !          5625: 370 cp
        !          5626: 4d0 cp
        !          5627: STRUCT
        !          5628: /l field rtas>token
        !          5629: /l field rtas>nargs
        !          5630: /l field rtas>nret
        !          5631: /l field rtas>args0
        !          5632: /l field rtas>args1
        !          5633: /l field rtas>args2
        !          5634: /l field rtas>args3
        !          5635: /l field rtas>args4
        !          5636: /l field rtas>args5
        !          5637: /l field rtas>args6
        !          5638: /l field rtas>args7
        !          5639: /l C * field rtas>args
        !          5640: /l field rtas>bla
        !          5641: CONSTANT /rtas-control-block
        !          5642: CREATE rtas-cb /rtas-control-block allot
        !          5643: rtas-cb /rtas-control-block erase
        !          5644: 0 VALUE rtas-base
        !          5645: 0 VALUE rtas-size
        !          5646: 0 VALUE rtas-entry
        !          5647: 0 VALUE rtas-node
        !          5648: 4d1 cp
        !          5649: : find-qemu-rtas ( -- )
        !          5650: " /rtas" find-device get-node to rtas-node
        !          5651: " linux,rtas-base" rtas-node get-package-property IF
        !          5652: device-end EXIT THEN
        !          5653: drop l@ to rtas-base
        !          5654: " linux,rtas-base" delete-property
        !          5655: " rtas-size" rtas-node get-package-property IF
        !          5656: device-end EXIT THEN
        !          5657: drop l@ to rtas-size
        !          5658: " linux,rtas-entry" rtas-node get-package-property IF
        !          5659: rtas-base to rtas-entry
        !          5660: ELSE
        !          5661: drop l@ to rtas-entry
        !          5662: " linux,rtas-entry" delete-property
        !          5663: THEN
        !          5664: device-end
        !          5665: ;
        !          5666: find-qemu-rtas
        !          5667: 4d2 cp
        !          5668: : enter-rtas ( -- )
        !          5669: rtas-cb rtas-base 0 rtas-entry call-c drop
        !          5670: ;
        !          5671: : rtas-get-token ( str len -- token | 0 )
        !          5672: rtas-node get-package-property IF 0 ELSE drop l@ THEN
        !          5673: ;
        !          5674: : rtas-start-cpu  ( pid loc r3 -- status )
        !          5675: " start-cpu" rtas-get-token rtas-cb rtas>token l!
        !          5676: 3  rtas-cb rtas>nargs l!
        !          5677: 1  rtas-cb rtas>nret l!
        !          5678: rtas-cb rtas>args2 l!
        !          5679: rtas-cb rtas>args1 l!
        !          5680: rtas-cb rtas>args0 l!
        !          5681: 0 rtas-cb rtas>args3 l!
        !          5682: enter-rtas
        !          5683: rtas-cb rtas>args3 l@
        !          5684: ;
        !          5685: : rtas-set-tce-bypass ( unit enable -- )
        !          5686: " ibm,set-tce-bypass" rtas-get-token rtas-cb rtas>token l!
        !          5687: 2 rtas-cb rtas>nargs l!
        !          5688: 0 rtas-cb rtas>nret l!
        !          5689: rtas-cb rtas>args1 l!
        !          5690: rtas-cb rtas>args0 l!
        !          5691: enter-rtas
        !          5692: ;
        !          5693: : rtas-quiesce ( -- )
        !          5694: " quiesce" rtas-get-token rtas-cb rtas>token l!
        !          5695: 0 rtas-cb rtas>nargs l!
        !          5696: 0 rtas-cb rtas>nret l!
        !          5697: enter-rtas
        !          5698: ;
        !          5699: 0 value puid
        !          5700: : rtas-do-config-@ ( config-addr size -- value)
        !          5701: " ibm,read-pci-config" rtas-get-token rtas-cb rtas>token l!
        !          5702: 4 rtas-cb rtas>nargs l!
        !          5703: 2 rtas-cb rtas>nret l!
        !          5704: ( addr size ) rtas-cb rtas>args3 l!
        !          5705: puid ffffffff and rtas-cb rtas>args2 l!
        !          5706: puid 20 rshift rtas-cb rtas>args1 l!
        !          5707: ( addr ) rtas-cb rtas>args0 l!
        !          5708: enter-rtas
        !          5709: rtas-cb rtas>args4 l@ dup IF
        !          5710: drop ffffffff
        !          5711: ELSE
        !          5712: drop rtas-cb rtas>args5 l@
        !          5713: THEN
        !          5714: ;
        !          5715: : rtas-do-config-! ( value config-addr size )
        !          5716: " ibm,write-pci-config" rtas-get-token rtas-cb rtas>token l!
        !          5717: 5 rtas-cb rtas>nargs l!
        !          5718: 1 rtas-cb rtas>nret l!
        !          5719: ( value addr size ) rtas-cb rtas>args3 l!
        !          5720: puid ffffffff and rtas-cb rtas>args2 l!
        !          5721: puid 20 rshift rtas-cb rtas>args1 l!
        !          5722: ( value addr ) rtas-cb rtas>args0 l!
        !          5723: ( value ) rtas-cb rtas>args4 l!
        !          5724: enter-rtas
        !          5725: rtas-cb rtas>args5 l@ dup IF
        !          5726: ." RTAS write config err " . cr
        !          5727: ELSE drop THEN
        !          5728: ;
        !          5729: : rtas-config-b@ ( config-addr -- value )
        !          5730: 1 rtas-do-config-@ ff and
        !          5731: ;
        !          5732: : rtas-config-b! ( value config-addr -- )
        !          5733: 1 rtas-do-config-!
        !          5734: ;
        !          5735: : rtas-config-w@ ( config-addr -- value )
        !          5736: 2 rtas-do-config-@ ffff and
        !          5737: ;
        !          5738: : rtas-config-w! ( value config-addr -- )
        !          5739: 2 rtas-do-config-!
        !          5740: ;
        !          5741: : rtas-config-l@ ( config-addr -- value )
        !          5742: 4 rtas-do-config-@ ffffffff and
        !          5743: ;
        !          5744: : rtas-config-l! ( value config-addr -- )
        !          5745: 4 rtas-do-config-!
        !          5746: ;
        !          5747: : of-start-cpu rtas-start-cpu ;
        !          5748: rtas-node set-node
        !          5749: : open true ;
        !          5750: : close ;
        !          5751: : instantiate-rtas ( adr -- entry )
        !          5752: dup rtas-base swap rtas-size move
        !          5753: rtas-entry rtas-base - +
        !          5754: ;
        !          5755: device-end
        !          5756: 4d8 cp
        !          5757: 390 cp
        !          5758: STRUCT
        !          5759: /n FIELD vd>base
        !          5760: /l FIELD vd>type
        !          5761: CONSTANT /vd-len
        !          5762: : virtio-setup-vd  ( vdstruct -- )
        !          5763: >r
        !          5764: s" class-code" get-node get-property 0= IF
        !          5765: 2drop
        !          5766: s" 10 config-l@ translate-my-address 3 not AND" evaluate
        !          5767: ( io-base ) r@ vd>base !
        !          5768: 0 r@ vd>type l!
        !          5769: ELSE
        !          5770: ." unsupported virtio interface!" cr
        !          5771: 1 r@ vd>type l!
        !          5772: THEN
        !          5773: r> drop
        !          5774: ;
        !          5775: 3f0 cp
        !          5776: : strequal ( str1 len1 str2 len2 -- flag )
        !          5777: rot dup rot = IF comp 0= ELSE 2drop drop 0 THEN ; 
        !          5778: 400 cp
        !          5779: " /" find-device
        !          5780: 480 cp
        !          5781: new-device
        !          5782: s" mmu" 2dup device-name device-type
        !          5783: 0 0 s" translations" property
        !          5784: : open  true ;
        !          5785: : close ;
        !          5786: finish-device
        !          5787: device-end
        !          5788: 4c0 cp
        !          5789: : fixup-tbfreq
        !          5790: " /cpus/@0" find-device
        !          5791: " timebase-frequency" get-node get-package-property IF
        !          5792: 2drop
        !          5793: ELSE
        !          5794: decode-int to tb-frequency 2drop
        !          5795: THEN
        !          5796: device-end
        !          5797: ;
        !          5798: fixup-tbfreq
        !          5799: 4d0 cp
        !          5800: include fbuffer.fs
        !          5801: 500 cp
        !          5802: : populate-vios ( -- )
        !          5803: ." Populating /vdevice methods" cr
        !          5804: " /vdevice" find-device get-node child
        !          5805: BEGIN
        !          5806: dup 0 <>
        !          5807: WHILE
        !          5808: dup set-node
        !          5809: dup " compatible" rot get-package-property 0 = IF
        !          5810: drop dup from-cstring
        !          5811: 2dup " hvterm1" strequal IF
        !          5812: " vio-hvterm.fs" included
        !          5813: THEN
        !          5814: 2dup " IBM,v-scsi" strequal IF
        !          5815: " vio-vscsi.fs" included
        !          5816: THEN
        !          5817: 2dup " IBM,l-lan" strequal IF
        !          5818: " vio-veth.fs" included
        !          5819: THEN
        !          5820: 2drop
        !          5821: THEN
        !          5822: peer
        !          5823: REPEAT drop
        !          5824: device-end
        !          5825: ;
        !          5826: populate-vios
        !          5827: 580 cp
        !          5828: 5a0 cp
        !          5829: VARIABLE pci-next-mem           \ prefetchable memory mapped
        !          5830: VARIABLE pci-max-mem
        !          5831: VARIABLE pci-next-mmio          \ non-prefetchable memory
        !          5832: VARIABLE pci-max-mmio
        !          5833: VARIABLE pci-next-io            \ I/O space
        !          5834: VARIABLE pci-max-io
        !          5835: 0 VALUE pci-bus-number
        !          5836: 0 VALUE pci-device-number
        !          5837: 0 VALUE pci-device-slots
        !          5838: here 100 allot CONSTANT pci-device-vec
        !          5839: 0 VALUE pci-device-vec-len
        !          5840: : next-pci-mem ( addr -- addr ) pci-next-mem ;
        !          5841: : next-pci-mmio ( addr -- addr ) pci-next-mmio ;
        !          5842: : next-pci-io ( addr -- addr ) pci-next-io ;
        !          5843: : int2str ( int len -- str len ) swap s>d rot <# 0 ?DO # LOOP #> ;
        !          5844: : pci-addr2bus ( addr -- busnr ) 10 rshift FF and ;
        !          5845: : pci-addr2dev ( addr -- dev ) B rshift 1F and ;
        !          5846: : pci-addr2fn ( addr -- dev ) 8 rshift 7 and ;
        !          5847: : pci-bus2addr ( busnr devnr -- addr ) B lshift swap 10 lshift + ;
        !          5848: : pci-addr-out ( addr -- ) dup pci-addr2bus 2 0.r space FFFF and 4 0.r ;
        !          5849: : pci-dump ( addr -- )
        !          5850: 10 0 DO
        !          5851: dup
        !          5852: cr i 4 * +
        !          5853: dup pci-addr-out space
        !          5854: rtas-config-l@ 8 0.r
        !          5855: LOOP
        !          5856: drop cr
        !          5857: ;
        !          5858: : pci-vendor@ ( addr -- id )                 rtas-config-l@ FFFF and ;
        !          5859: : pci-device@ ( addr -- id )                 rtas-config-l@ 10 rshift ;
        !          5860: : pci-status@ ( addr -- status )         4 + rtas-config-l@ 10 rshift ;
        !          5861: : pci-revision@ ( addr -- id )           8 + rtas-config-b@ ;
        !          5862: : pci-class@  ( addr -- class )          8 + rtas-config-l@ 8 rshift ;
        !          5863: : pci-cache@  ( addr -- size )           C + rtas-config-b@ ;
        !          5864: : pci-htype@  ( addr -- type )           E + rtas-config-b@  ;
        !          5865: : pci-sub-vendor@ ( addr -- sub-id )    2C + rtas-config-l@ FFFF and ;
        !          5866: : pci-sub-device@ ( addr -- sub-id )    2C + rtas-config-l@ 10 rshift FFFF and ;
        !          5867: : pci-interrupt@  ( addr -- interrupt ) 3D + rtas-config-b@ ;
        !          5868: : pci-min-grant@  ( addr -- min-gnt )   3E + rtas-config-b@ ;
        !          5869: : pci-max-lat@  ( addr -- max-lat )     3F + rtas-config-b@ ;
        !          5870: : pci-capabilities?  ( addr -- 0|1 ) pci-status@ 4 rshift 1 and ;
        !          5871: : pci-cap-next  ( cap-addr -- next-cap-off ) rtas-config-b@ FC and ;
        !          5872: : pci-cap-next-addr  ( cap-addr -- next-cap-addr ) 1+ dup pci-cap-next dup IF swap -100 and + ELSE nip THEN ;
        !          5873: : pci-cap-dump ( addr -- )
        !          5874: cr
        !          5875: dup pci-capabilities? IF
        !          5876: 33 + BEGIN
        !          5877: pci-cap-next-addr dup 0<>
        !          5878: WHILE
        !          5879: dup pci-addr-out s"  : " type
        !          5880: dup rtas-config-b@ 2 0.r cr
        !          5881: REPEAT
        !          5882: s" end found "
        !          5883: ELSE
        !          5884: s" capabilities not enabled!"
        !          5885: THEN
        !          5886: type cr drop
        !          5887: ;
        !          5888: : pci-cap-find ( addr id -- capp-addr|0 )
        !          5889: swap dup pci-capabilities? IF
        !          5890: 33 + BEGIN
        !          5891: pci-cap-next-addr dup 0<> IF
        !          5892: dup rtas-config-b@ 2 pick =
        !          5893: ELSE
        !          5894: true
        !          5895: THEN
        !          5896: UNTIL
        !          5897: nip
        !          5898: ELSE
        !          5899: 2drop 0
        !          5900: THEN
        !          5901: ;
        !          5902: : pci-express? ( addr -- 0|1 ) 10 pci-cap-find 0<> ;
        !          5903: : pci-x? ( addr -- 0|1 ) 07 pci-cap-find 0<> ;
        !          5904: : pci-config-ext? ( addr -- 0|1 ) pci-express? ;
        !          5905: : pci-device-disable ( -- ) my-space 4 + dup rtas-config-l@ 7 invert and swap rtas-config-l! ;
        !          5906: : pci-master-enable ( -- ) my-space 4 + dup rtas-config-l@ 4 or swap rtas-config-l! ;
        !          5907: : pci-master-disable ( -- ) my-space 4 + dup rtas-config-l@ 4 invert and swap rtas-config-l! ;
        !          5908: : pci-mem-enable ( -- ) my-space 4 + dup rtas-config-w@ 2 or swap rtas-config-w! ;
        !          5909: : pci-io-enable ( -- ) my-space 4 + dup rtas-config-w@ 1 or swap rtas-config-w! ;
        !          5910: : pci-enable ( -- ) my-space 4 + dup rtas-config-w@ 7 or swap rtas-config-w! ;
        !          5911: : pci-error-enable ( -- ) my-space 4 + dup rtas-config-w@ 140 or swap rtas-config-w! ;
        !          5912: : pci-out ( addr char -- )
        !          5913: 15 spaces
        !          5914: over pci-addr-out
        !          5915: s"  (" type emit s" ) : " type
        !          5916: dup pci-vendor@ 4 0.r space
        !          5917: pci-device@ 4 0.r
        !          5918: 4 spaces
        !          5919: ;
        !          5920: : pci-irq-line@  ( addr -- irq-pin ) 3C + rtas-config-b@ ;
        !          5921: : pci-irq-line!  ( pin addr -- ) 3C + rtas-config-b! ;
        !          5922: : pci-bus-prim! ( nr addr -- ) 18 + dup rtas-config-l@ FFFFFF00 and rot + swap rtas-config-l! ;
        !          5923: : pci-bus-prim@ ( addr -- nr ) 18 + rtas-config-l@ FF and ;
        !          5924: : pci-bus-scnd! ( nr addr -- ) 18 + dup rtas-config-l@ FFFF00FF and rot 8 lshift + swap rtas-config-l! ;
        !          5925: : pci-bus-scnd@ ( addr -- nr ) 18 + rtas-config-l@ 8 rshift FF and ;
        !          5926: : pci-bus-subo! ( nr addr -- ) 18 + dup rtas-config-l@ FF00FFFF and rot 10 lshift + swap rtas-config-l! ;
        !          5927: : pci-bus-subo@ ( addr -- nr ) 18 + rtas-config-l@ 10 rshift FF and ;
        !          5928: : pci-bus! ( subo scnd prim addr -- ) swap rot 8 lshift + rot 10 lshift + swap 18 + dup rtas-config-l@ FF000000 and rot + swap rtas-config-l! ;
        !          5929: : pci-bus@ ( addr -- subo scnd prim ) 18 + rtas-config-l@ dup 10 rshift FF and swap dup 8 rshift FF and swap FF and ;
        !          5930: : pci-reset-2nd ( addr -- ) 1C + dup rtas-config-l@ FFFF0000 or swap rtas-config-l! ;
        !          5931: : pci-vec ( -- )
        !          5932: cr s" device-vec(" type
        !          5933: pci-device-vec-len dup 2 0.r s" ):" type
        !          5934: 1+ 0 DO
        !          5935: pci-device-vec i + c@
        !          5936: space 2 0.r
        !          5937: LOOP
        !          5938: cr
        !          5939: ;
        !          5940: : pci-var-out ( -- )
        !          5941: s"   mem:" type pci-next-mem @ 16 0.r cr
        !          5942: s"  mmio:" type pci-next-mmio @ 16 0.r cr
        !          5943: s"    io:" type pci-next-io @ 16 0.r cr
        !          5944: ;
        !          5945: : pci-set-slot ( addr -- )
        !          5946: pci-addr2dev dup                \ calc slot number
        !          5947: pci-device-vec-len              \ the end of the vector
        !          5948: pci-device-vec + c!             \ and update the vector
        !          5949: 80000000 swap rshift            \ calc bit position of the device slot
        !          5950: pci-device-slots or             \ set this bit
        !          5951: TO pci-device-slots             \ and write it back
        !          5952: ;
        !          5953: : pci-bridge-set-mmio-base ( addr -- )
        !          5954: pci-next-mmio @ 100000 #aligned         \ read the current Value and align to 1MB boundary
        !          5955: dup pci-next-mmio !                     \ and write it back
        !          5956: 10 rshift                               \ mmio-base reg is only the upper 16 bits
        !          5957: pci-max-mmio @ FFFF0000 and or          \ and Insert mmio Limit (set it to max)
        !          5958: swap 20 + rtas-config-l!                \ and write it into the bridge
        !          5959: ;
        !          5960: : pci-bridge-set-mmio-limit ( addr -- )
        !          5961: pci-next-mmio @ 100000 #aligned         \ fetch current value and align to 1MB
        !          5962: dup pci-next-mmio !                     \ and write it back
        !          5963: 1- FFFF0000 and                         \ make it one less and keep upper 16 bits
        !          5964: over 20 + rtas-config-l@ 0000FFFF and   \ fetch original value
        !          5965: or swap 20 + rtas-config-l!             \ and write it into the Reg
        !          5966: ;
        !          5967: : pci-bridge-set-mem-base ( addr -- )
        !          5968: pci-next-mem @ 100000 #aligned          \ read the current Value and align to 1MB boundary
        !          5969: dup pci-next-mem !                      \ and write it back
        !          5970: over 24 + rtas-config-w@                \ check if 64bit support
        !          5971: 1 and IF                                \ IF 64 bit support
        !          5972: 2dup 20 rshift                  \ | keep upper 32 bits
        !          5973: swap 28 + rtas-config-l!        \ | and write it into the Base-Upper32-bits
        !          5974: pci-max-mem @ 20 rshift         \ | fetch max Limit address and keep upper 32 bits
        !          5975: 2 pick 2C + rtas-config-l!      \ | and set the Limit
        !          5976: THEN                                    \ FI
        !          5977: 10 rshift                               \ keep upper 16 bits
        !          5978: pci-max-mem @ FFFF0000 and or           \ and Insert mmem Limit (set it to max)
        !          5979: swap 24 + rtas-config-l!                \ and write it into the bridge
        !          5980: ;
        !          5981: : pci-bridge-set-mem-limit ( addr -- )
        !          5982: pci-next-mem @ 100000 #aligned          \ read the current Value and align to 1MB boundary
        !          5983: dup pci-next-mem !                      \ and write it back
        !          5984: 1-                                      \ make limit one less than boundary
        !          5985: over 24 + rtas-config-w@                \ check if 64bit support
        !          5986: 1 and IF                                \ IF 64 bit support
        !          5987: 2dup 20 rshift                  \ | keep upper 32 bits
        !          5988: swap 2C + rtas-config-l!        \ | and write it into the Limit-Upper32-bits
        !          5989: THEN                                    \ FI
        !          5990: FFFF0000 and                            \ keep upper 16 bits
        !          5991: over 24 + rtas-config-l@ 0000FFFF and   \ fetch original Value
        !          5992: or swap 24 + rtas-config-l!             \ and write it into the bridge
        !          5993: ;
        !          5994: : pci-bridge-set-io-base ( addr -- )
        !          5995: pci-next-io @ 1000 #aligned             \ read the current Value and align to 4KB boundary
        !          5996: dup pci-next-io !                       \ and write it back
        !          5997: over 1C + rtas-config-l@                \ check if 32bit support
        !          5998: 1 and IF                                \ IF 32 bit support
        !          5999: 2dup 10 rshift                  \ | keep upper 16 bits
        !          6000: pci-max-io @ FFFF0000 and or    \ | insert upper 16 bits of Max-Limit
        !          6001: swap 30 + rtas-config-l!        \ | and write it into the Base-Upper16-bits
        !          6002: THEN                                    \ FI
        !          6003: 8 rshift 000000FF and                   \ keep upper 8 bits
        !          6004: pci-max-io @ 0000FF00 and or            \ insert upper 8 bits of Max-Limit
        !          6005: over rtas-config-l@ FFFF0000 and        \ fetch original Value
        !          6006: or swap 1C + rtas-config-l!             \ and write it into the bridge
        !          6007: ;
        !          6008: : pci-bridge-set-io-limit ( addr -- )
        !          6009: pci-next-io @ 1000 #aligned             \ read the current Value and align to 4KB boundary
        !          6010: dup pci-next-io !                       \ and write it back
        !          6011: 1-                                      \ make limit one less than boundary
        !          6012: over 1D + rtas-config-b@                \ check if 32bit support
        !          6013: 1 and IF                                \ IF 32 bit support
        !          6014: 2dup FFFF0000 and               \ | keep upper 16 bits
        !          6015: over 30 + rtas-config-l@        \ | fetch original Value
        !          6016: or swap 30 + rtas-config-l!     \ | and write it into the Limit-Upper16-bits
        !          6017: THEN                                    \ FI
        !          6018: 0000FF00 and                            \ keep upper 8 bits
        !          6019: over 1C + rtas-config-l@ FFFF00FF and   \ fetch original Value
        !          6020: or swap 1C + rtas-config-l!             \ and write it into the bridge
        !          6021: ;
        !          6022: : pci-bridge-set-bases ( addr -- )
        !          6023: dup pci-bridge-set-mmio-base
        !          6024: dup pci-bridge-set-mem-base
        !          6025: pci-bridge-set-io-base
        !          6026: ;
        !          6027: : pci-bridge-set-limits ( addr -- )
        !          6028: dup pci-bridge-set-mmio-limit
        !          6029: dup pci-bridge-set-mem-limit
        !          6030: pci-bridge-set-io-limit
        !          6031: ;
        !          6032: DEFER func-pci-probe-bus
        !          6033: : pci-bridge-probe ( addr -- )
        !          6034: dup pci-bridge-set-bases                        \ SetUp all Base Registers
        !          6035: pci-bus-number 1+ TO pci-bus-number             \ increase number of busses found
        !          6036: pci-device-vec-len 1+ TO pci-device-vec-len     \ increase the device-slot vector depth
        !          6037: dup                                             \ stack config-addr for pci-bus!
        !          6038: FF swap                                         \ Subordinate Bus Number ( for now to max to open all subbusses )
        !          6039: pci-bus-number swap                             \ Secondary   Bus Number ( the new busnumber )
        !          6040: dup pci-addr2bus swap                           \ Primary     Bus Number ( the current bus )
        !          6041: pci-bus!                                        \ and set them into the bridge
        !          6042: pci-enable                                      \ enable mem/IO transactions
        !          6043: dup pci-bus-scnd@ func-pci-probe-bus            \ and probe the secondary bus
        !          6044: dup pci-bus-number swap pci-bus-subo!           \ set SubOrdinate Bus Number to current number of busses
        !          6045: pci-device-vec-len 1- TO pci-device-vec-len     \ decrease the device-slot vector depth
        !          6046: dup pci-bridge-set-limits                       \ SetUp all Limit Registers
        !          6047: drop                                            \ forget the config-addr
        !          6048: ;
        !          6049: : pci-device-setup ( addr -- )
        !          6050: drop                            \ since the config-addr is coded in my-space, drop it here
        !          6051: s" pci-device.fs" included      \ and setup the device as node in the device tree
        !          6052: ;
        !          6053: : pci-bridge-setup ( addr -- )
        !          6054: drop                            \ since the config-addr is coded in my-space, drop it here
        !          6055: s" pci-bridge.fs" included      \ and setup the bridge as node in the device tree
        !          6056: ;
        !          6057: : pci-add-device ( addr -- )
        !          6058: new-device                      \ create a new device-tree node
        !          6059: dup set-space               \ set the config addr for this device tree entry
        !          6060: dup pci-set-slot            \ set the slot bit
        !          6061: dup pci-htype@              \ read HEADER-Type
        !          6062: 1 and IF                    \ IF BRIDGE
        !          6063: pci-bridge-setup    \ | set up the bridge
        !          6064: ELSE                        \ ELSE
        !          6065: pci-device-setup    \ | set up the device
        !          6066: THEN                        \ FI
        !          6067: finish-device                   \ and close the device-tree node
        !          6068: ;
        !          6069: : pci-setup-device ( addr -- )
        !          6070: dup pci-htype@                      \ read HEADER-Type
        !          6071: 80 and IF 8 ELSE 1 THEN             \ check for multifunction
        !          6072: 0 DO                                \ LOOP over all possible functions (either 8 or only 1)
        !          6073: dup
        !          6074: i 8 lshift +                \ calc device-function-config-addr
        !          6075: dup pci-vendor@             \ check if valid function
        !          6076: FFFF = IF
        !          6077: drop                \ non-valid so forget the address
        !          6078: ELSE
        !          6079: pci-device-number 1+    \ increase the number of devices
        !          6080: TO pci-device-number    \ and store it
        !          6081: pci-add-device          \ and add the device to the device tree and set it up
        !          6082: THEN
        !          6083: LOOP                                \ next function
        !          6084: drop                                \ forget the device-addr
        !          6085: ;
        !          6086: : pci-probe-device ( busnr devicenr -- )
        !          6087: pci-bus2addr                                    \ calc pci-address
        !          6088: dup pci-vendor@                                 \ fetch Vendor-ID
        !          6089: FFFF = IF                                       \ check if valid
        !          6090: drop                                    \ if not forget it
        !          6091: ELSE
        !          6092: pci-setup-device                        \ if valid setup the device
        !          6093: THEN
        !          6094: ;
        !          6095: : pci-probe-bus ( busnr -- )
        !          6096: 0 TO pci-device-slots           \ reset slot array to unpoppulated
        !          6097: 20 0 DO
        !          6098: dup
        !          6099: i pci-probe-device
        !          6100: LOOP
        !          6101: drop
        !          6102: ;
        !          6103: ' pci-probe-bus TO func-pci-probe-bus
        !          6104: : pci-probe-all ( bus-max bus-min -- )                  \ Check all busses from bus-min up to bus-max if needed
        !          6105: 0 TO pci-device-vec-len                         \ reset the device-slot vector
        !          6106: DO
        !          6107: i TO pci-bus-number                     \ set current Busnumber
        !          6108: 0 TO pci-device-number                  \ reset Device Number
        !          6109: pci-bus-number pci-probe-bus            \ and probe this bus
        !          6110: pci-device-number 0 > IF LEAVE THEN     \ if we found a device we're done
        !          6111: LOOP                                            \ else next bus
        !          6112: ;
        !          6113: : (probe-pci-host-bridge) ( bus-max bus-min -- )
        !          6114: 0d emit ."  Adapters on " puid 10 0.r cr        \ print the puid we're looking at
        !          6115: ( bus-max bus-min ) pci-probe-all               \ and walk the bus
        !          6116: pci-device-number 0= IF                         \ IF no devices found
        !          6117: 15 spaces                               \ | indent the output
        !          6118: ." None" cr                             \ | tell the world our result
        !          6119: THEN                                            \ FI
        !          6120: ;
        !          6121: : probe-pci-host-bridge ( bus-max bus-min mmio-max mmio-base mem-max mem-base io-max io-base my-puid -- )
        !          6122: puid >r TO puid                                 \ save puid and set the new
        !          6123: pci-next-io !                                   \ save the next io-base address
        !          6124: pci-max-io !                                    \ save the max io-space address
        !          6125: pci-next-mem !                                  \ save the next mem-base address
        !          6126: pci-max-mem !                                   \ save the max mem-space address
        !          6127: pci-next-mmio !                                 \ save the next mmio-base address
        !          6128: pci-max-mmio !                                  \ save the max mmio-space address
        !          6129: (probe-pci-host-bridge)
        !          6130: r> TO  puid                                     \ restore puid
        !          6131: ;
        !          6132: 0 VALUE pci-net-num
        !          6133: 0 VALUE pci-disk-num
        !          6134: 0 VALUE pci-cdrom-num
        !          6135: : pci-set-alias ( str-addr str-len num -- )
        !          6136: $cathex strdup       \ create alias name
        !          6137: get-node node>path   \ get path string
        !          6138: set-alias            \ and set the alias
        !          6139: ;
        !          6140: : unknown-enet ( -- pci-net-num )
        !          6141: pci-net-num dup 1+ TO pci-net-num
        !          6142: ;
        !          6143: : pci-alias-net ( config-addr -- )
        !          6144: drop                                   \ forget the config address
        !          6145: pci-net-num dup 1+ TO pci-net-num      \ increase the pci-net-num
        !          6146: s" net" rot pci-set-alias              \ create the alias
        !          6147: ;
        !          6148: : pci-alias-disk ( config-addr -- )
        !          6149: drop                                    \ forget the config address
        !          6150: pci-disk-num dup 1+ TO pci-disk-num     \ increase the pci-disk-num
        !          6151: s" disk" rot pci-set-alias              \ create the alias
        !          6152: ;
        !          6153: : pci-alias-cdrom ( config-addr -- )
        !          6154: drop                                    \ forget the config address
        !          6155: pci-cdrom-num dup 1+ TO pci-cdrom-num     \ increase the pci-cdrom-num
        !          6156: s" cdrom" rot pci-set-alias              \ create the alias
        !          6157: ;
        !          6158: : pci-alias ( config-addr -- )
        !          6159: dup pci-class@ 
        !          6160: 10 rshift CASE
        !          6161: 01 OF   pci-alias-disk ENDOF
        !          6162: 02 OF   pci-alias-net  ENDOF
        !          6163: dup OF   drop           ENDOF
        !          6164: ENDCASE
        !          6165: ;
        !          6166: : pci-gen-irq-entry ( prop-addr prop-len config-addr -- prop-addr prop-len )
        !          6167: ." SHOULD NOT GET THERE !" cr
        !          6168: drop
        !          6169: ;
        !          6170: : pci-set-irq-line ( config-addr -- )
        !          6171: drop
        !          6172: ;
        !          6173: : pci-set-capabilities ( config-addr -- )
        !          6174: drop
        !          6175: ;
        !          6176: : pci-class-name-00 ( addr -- str len )
        !          6177: pci-class@ 8 rshift FF and CASE
        !          6178: 01  OF s" display"               ENDOF
        !          6179: dup OF s" unknown-legacy-device" ENDOF
        !          6180: ENDCASE
        !          6181: ;
        !          6182: : pci-class-name-01 ( addr -- str len )
        !          6183: pci-class@ 8 rshift FF and CASE
        !          6184: 00  OF s" scsi"         ENDOF
        !          6185: 01  OF s" ide"          ENDOF
        !          6186: 02  OF s" fdc"          ENDOF
        !          6187: 03  OF s" ipi"          ENDOF
        !          6188: 04  OF s" raid"         ENDOF
        !          6189: 05  OF s" ata"          ENDOF
        !          6190: 06  OF s" sata"         ENDOF
        !          6191: 07  OF s" sas"          ENDOF
        !          6192: dup OF s" mass-storage" ENDOF
        !          6193: ENDCASE
        !          6194: ;
        !          6195: : pci-class-name-02 ( addr -- str len )
        !          6196: pci-class@ 8 rshift FF and CASE
        !          6197: 00  OF s" ethernet"   ENDOF
        !          6198: 01  OF s" token-ring" ENDOF
        !          6199: 02  OF s" fddi"       ENDOF
        !          6200: 03  OF s" atm"        ENDOF
        !          6201: 04  OF s" isdn"       ENDOF
        !          6202: 05  OF s" worldfip"   ENDOF
        !          6203: 05  OF s" picmg"      ENDOF
        !          6204: dup OF s" network"    ENDOF
        !          6205: ENDCASE
        !          6206: ;
        !          6207: : pci-class-name-03 ( addr -- str len )
        !          6208: pci-class@ FFFF and CASE
        !          6209: 0000  OF s" vga"             ENDOF
        !          6210: 0001  OF s" 8514-compatible" ENDOF
        !          6211: 0100  OF s" xga"             ENDOF
        !          6212: 0200  OF s" 3d-controller"   ENDOF
        !          6213: dup OF s" display"           ENDOF
        !          6214: ENDCASE
        !          6215: ;
        !          6216: : pci-class-name-04 ( addr -- str len )
        !          6217: pci-class@ 8 rshift FF and CASE
        !          6218: 00  OF s" video"             ENDOF
        !          6219: 01  OF s" sound"             ENDOF
        !          6220: 02  OF s" telephony"         ENDOF
        !          6221: dup OF s" multimedia-device" ENDOF
        !          6222: ENDCASE
        !          6223: ;
        !          6224: : pci-class-name-05 ( addr -- str len )
        !          6225: pci-class@ 8 rshift FF and CASE
        !          6226: 00  OF s" memory"            ENDOF
        !          6227: 01  OF s" flash"             ENDOF
        !          6228: dup OF s" memory-controller" ENDOF
        !          6229: ENDCASE
        !          6230: ;
        !          6231: : pci-class-name-06 ( addr -- str len )
        !          6232: pci-class@ 8 rshift FF and CASE
        !          6233: 00  OF s" host"                 ENDOF
        !          6234: 01  OF s" isa"                  ENDOF
        !          6235: 02  OF s" eisa"                 ENDOF
        !          6236: 03  OF s" mca"                  ENDOF
        !          6237: 04  OF s" pci"                  ENDOF
        !          6238: 05  OF s" pcmcia"               ENDOF
        !          6239: 06  OF s" nubus"                ENDOF
        !          6240: 07  OF s" cardbus"              ENDOF
        !          6241: 08  OF s" raceway"              ENDOF
        !          6242: 09  OF s" semi-transparent-pci" ENDOF
        !          6243: 0A  OF s" infiniband"           ENDOF
        !          6244: dup OF s" unkown-bridge"        ENDOF
        !          6245: ENDCASE
        !          6246: ;
        !          6247: : pci-class-name-07 ( addr -- str len )
        !          6248: pci-class@ FFFF and CASE
        !          6249: 0000  OF s" serial"                   ENDOF
        !          6250: 0001  OF s" 16450-serial"             ENDOF
        !          6251: 0002  OF s" 16550-serial"             ENDOF
        !          6252: 0003  OF s" 16650-serial"             ENDOF
        !          6253: 0004  OF s" 16750-serial"             ENDOF
        !          6254: 0005  OF s" 16850-serial"             ENDOF
        !          6255: 0006  OF s" 16950-serial"             ENDOF
        !          6256: 0100  OF s" parallel"                 ENDOF
        !          6257: 0101  OF s" bi-directional-parallel"  ENDOF
        !          6258: 0102  OF s" ecp-1.x-parallel"         ENDOF
        !          6259: 0103  OF s" ieee1284-controller"      ENDOF
        !          6260: 01FE  OF s" ieee1284-device"          ENDOF
        !          6261: 0200  OF s" multiport-serial"         ENDOF
        !          6262: 0300  OF s" modem"                    ENDOF
        !          6263: 0301  OF s" 16450-modem"              ENDOF
        !          6264: 0302  OF s" 16550-modem"              ENDOF
        !          6265: 0303  OF s" 16650-modem"              ENDOF
        !          6266: 0304  OF s" 16750-modem"              ENDOF
        !          6267: 0400  OF s" gpib"                     ENDOF
        !          6268: 0500  OF s" smart-card"               ENDOF
        !          6269: dup   OF s" communication-controller" ENDOF
        !          6270: ENDCASE
        !          6271: ;
        !          6272: : pci-class-name-08 ( addr -- str len )
        !          6273: pci-class@ FFFF and CASE
        !          6274: 0000  OF s" interrupt-controller" ENDOF
        !          6275: 0001  OF s" isa-pic"              ENDOF
        !          6276: 0002  OF s" eisa-pic"             ENDOF
        !          6277: 0010  OF s" io-apic"              ENDOF
        !          6278: 0020  OF s" iox-apic"             ENDOF
        !          6279: 0100  OF s" dma-controller"       ENDOF
        !          6280: 0101  OF s" isa-dma"              ENDOF
        !          6281: 0102  OF s" eisa-dma"             ENDOF
        !          6282: 0200  OF s" timer"                ENDOF
        !          6283: 0201  OF s" isa-system-timer"     ENDOF
        !          6284: 0202  OF s" eisa-system-timer"    ENDOF
        !          6285: 0300  OF s" rtc"                  ENDOF
        !          6286: 0301  OF s" isa-rtc"              ENDOF
        !          6287: 0400  OF s" hot-plug-controller"  ENDOF
        !          6288: 0500  OF s" sd-host-conrtoller"   ENDOF
        !          6289: dup   OF s" system-periphal"      ENDOF
        !          6290: ENDCASE
        !          6291: ;
        !          6292: : pci-class-name-09 ( addr -- str len )
        !          6293: pci-class@ 8 rshift FF and CASE
        !          6294: 00  OF s" keyboard"         ENDOF
        !          6295: 01  OF s" pen"              ENDOF
        !          6296: 02  OF s" mouse"            ENDOF
        !          6297: 03  OF s" scanner"          ENDOF
        !          6298: 04  OF s" gameport"         ENDOF
        !          6299: dup OF s" input-controller" ENDOF
        !          6300: ENDCASE
        !          6301: ;
        !          6302: : pci-class-name-0A ( addr -- str len )
        !          6303: pci-class@ 8 rshift FF and CASE
        !          6304: 00  OF s" dock"            ENDOF
        !          6305: dup OF s" docking-station" ENDOF
        !          6306: ENDCASE
        !          6307: ;
        !          6308: : pci-class-name-0B ( addr -- str len )
        !          6309: pci-class@ 8 rshift FF and CASE
        !          6310: 00  OF s" 386"           ENDOF
        !          6311: 01  OF s" 486"           ENDOF
        !          6312: 02  OF s" pentium"       ENDOF
        !          6313: 10  OF s" alpha"         ENDOF
        !          6314: 20  OF s" powerpc"       ENDOF
        !          6315: 30  OF s" mips"          ENDOF
        !          6316: 40  OF s" co-processor"  ENDOF
        !          6317: dup OF s" cpu"           ENDOF
        !          6318: ENDCASE
        !          6319: ;
        !          6320: : pci-class-name-0C ( addr -- str len )
        !          6321: pci-class@ FFFF and CASE
        !          6322: 0000  OF s" firewire"      ENDOF
        !          6323: 0100  OF s" access-bus"    ENDOF
        !          6324: 0200  OF s" ssa"           ENDOF
        !          6325: 0300  OF s" usb-uhci"      ENDOF
        !          6326: 0310  OF s" usb-ohci"      ENDOF
        !          6327: 0320  OF s" usb-ehci"      ENDOF
        !          6328: 0380  OF s" usb"           ENDOF
        !          6329: 03FE  OF s" usb-device"    ENDOF
        !          6330: 0400  OF s" fibre-channel" ENDOF
        !          6331: 0500  OF s" smb"           ENDOF
        !          6332: 0600  OF s" infiniband"    ENDOF
        !          6333: 0700  OF s" ipmi-smic"     ENDOF
        !          6334: 0701  OF s" ipmi-kbrd"     ENDOF
        !          6335: 0702  OF s" ipmi-bltr"     ENDOF
        !          6336: 0800  OF s" sercos"        ENDOF
        !          6337: 0900  OF s" canbus"        ENDOF
        !          6338: dup OF s" serial-bus"      ENDOF
        !          6339: ENDCASE
        !          6340: ;
        !          6341: : pci-class-name-0D ( addr -- str len )
        !          6342: pci-class@ 8 rshift FF and CASE
        !          6343: 00  OF s" irda"                ENDOF
        !          6344: 01  OF s" consumer-ir"         ENDOF
        !          6345: 10  OF s" rf-controller"       ENDOF
        !          6346: 11  OF s" bluetooth"           ENDOF
        !          6347: 12  OF s" broadband"           ENDOF
        !          6348: 20  OF s" enet-802.11a"        ENDOF
        !          6349: 21  OF s" enet-802.11b"        ENDOF
        !          6350: dup OF s" wireless-controller" ENDOF
        !          6351: ENDCASE
        !          6352: ;
        !          6353: : pci-class-name-0E ( addr -- str len )
        !          6354: pci-class@ 8 rshift FF and CASE
        !          6355: dup OF s" intelligent-io" ENDOF
        !          6356: ENDCASE
        !          6357: ;
        !          6358: : pci-class-name-0F ( addr -- str len )
        !          6359: pci-class@ 8 rshift FF and CASE
        !          6360: 01  OF s" satelite-tv"     ENDOF
        !          6361: 02  OF s" satelite-audio"  ENDOF
        !          6362: 03  OF s" satelite-voice"  ENDOF
        !          6363: 04  OF s" satelite-data"   ENDOF
        !          6364: dup OF s" satelite-devoce" ENDOF
        !          6365: ENDCASE
        !          6366: ;
        !          6367: : pci-class-name-10 ( addr -- str len )
        !          6368: pci-class@ 8 rshift FF and CASE
        !          6369: 00  OF s" network-encryption"       ENDOF
        !          6370: 01  OF s" entertainment-encryption" ENDOF
        !          6371: dup OF s" encryption"               ENDOF
        !          6372: ENDCASE
        !          6373: ;
        !          6374: : pci-class-name-11 ( addr -- str len )
        !          6375: pci-class@ 8 rshift FF and CASE
        !          6376: 00  OF s" dpio"                       ENDOF
        !          6377: 01  OF s" counter"                    ENDOF
        !          6378: 10  OF s" measurement"                ENDOF
        !          6379: 20  OF s" managment-card"             ENDOF
        !          6380: dup OF s" data-processing-controller" ENDOF
        !          6381: ENDCASE
        !          6382: ;
        !          6383: : pci-class-name ( addr -- str len )
        !          6384: dup pci-class@ 10 rshift CASE
        !          6385: 00  OF pci-class-name-00 ENDOF
        !          6386: 01  OF pci-class-name-01 ENDOF
        !          6387: 02  OF pci-class-name-02 ENDOF
        !          6388: 03  OF pci-class-name-03 ENDOF
        !          6389: 04  OF pci-class-name-04 ENDOF
        !          6390: 05  OF pci-class-name-05 ENDOF
        !          6391: 06  OF pci-class-name-06 ENDOF
        !          6392: 07  OF pci-class-name-07 ENDOF
        !          6393: 08  OF pci-class-name-08 ENDOF
        !          6394: 09  OF pci-class-name-09 ENDOF
        !          6395: 0A  OF pci-class-name-0A ENDOF
        !          6396: 0B  OF pci-class-name-0B ENDOF
        !          6397: 0C  OF pci-class-name-0C ENDOF
        !          6398: 0C  OF pci-class-name-0D ENDOF
        !          6399: 0C  OF pci-class-name-0E ENDOF
        !          6400: 0C  OF pci-class-name-0F ENDOF
        !          6401: 0C  OF pci-class-name-10 ENDOF
        !          6402: 0C  OF pci-class-name-11 ENDOF
        !          6403: dup OF drop s" unknown"  ENDOF
        !          6404: ENDCASE
        !          6405: ;
        !          6406: : pci-bar-size@     ( bar-addr -- bar-size ) -1 over rtas-config-l! rtas-config-l@ ;
        !          6407: : pci-bar-size-mem@ ( bar-addr -- mem-size ) pci-bar-size@ -10 and invert 1+ FFFFFFFF and ;
        !          6408: : pci-bar-size-io@  ( bar-addr -- io-size  ) pci-bar-size@ -4 and invert 1+ FFFFFFFF and ;
        !          6409: : pci-bar-size ( bar-addr -- bar-size-raw )
        !          6410: dup rtas-config-l@ swap \ fetch original Value  ( bval baddr )
        !          6411: -1 over rtas-config-l!  \ make BAR show size    ( bval baddr )
        !          6412: dup rtas-config-l@      \ and fetch the size    ( bval baddr bsize )
        !          6413: -rot rtas-config-l!     \ restore Value
        !          6414: ;
        !          6415: : pci-bar-size-mem32 ( bar-addr -- bar-size )
        !          6416: pci-bar-size            \ fetch raw size
        !          6417: -10 and invert 1+       \ calc size
        !          6418: FFFFFFFF and            \ keep lower 32 bits
        !          6419: ;
        !          6420: : pci-bar-size-rom ( bar-addr -- bar-size )
        !          6421: pci-bar-size            \ fetch raw size
        !          6422: FFFFF800 and invert 1+  \ calc size
        !          6423: FFFFFFFF and            \ keep lower 32 bits
        !          6424: ;
        !          6425: : pci-bar-size-mem64 ( bar-addr -- bar-size )
        !          6426: dup pci-bar-size        \ fetch raw size lower 32 bits
        !          6427: swap 4 + pci-bar-size   \ fetch raw size upper 32 bits
        !          6428: 20 lshift +             \ and put them together
        !          6429: -10 and invert 1+       \ calc size
        !          6430: ;
        !          6431: : pci-bar-size-io ( bar-addr -- bar-size )
        !          6432: pci-bar-size            \ fetch raw size
        !          6433: -4 and invert 1+        \ calc size
        !          6434: FFFFFFFF and            \ keep lower 32 bits
        !          6435: ;
        !          6436: : pci-bar-code@ ( bar-addr -- 0|1..4|5 )
        !          6437: rtas-config-l@ dup                \ fetch the BaseAddressRegister
        !          6438: 1 and IF                          \ IO BAR ?
        !          6439: 2 and IF 0 ELSE 1 THEN    \ only '01' is valid
        !          6440: ELSE                              \ Memory BAR ?
        !          6441: F and CASE
        !          6442: 0   OF 2 ENDOF    \ Memory 32 Bit Non-Prefetchable
        !          6443: 8   OF 3 ENDOF    \ Memory 32 Bit Prefetchable
        !          6444: 4   OF 4 ENDOF    \ Memory 64 Bit Non-Prefetchable
        !          6445: C   OF 5 ENDOF    \ Memory 64 Bit Prefechtable
        !          6446: dup OF 0 ENDOF    \ Not a valid BarType
        !          6447: ENDCASE
        !          6448: THEN
        !          6449: ;
        !          6450: : assign-var ( size var -- al-mem )
        !          6451: 2dup @                          \ ( size var size cur-mem ) read current free mem
        !          6452: swap #aligned                   \ ( size var al-mem )       align the mem to the size
        !          6453: dup 2swap -rot +                \ ( al-mem var new-mem )    add size to aligned mem
        !          6454: swap !                          \ ( al-mem )                set variable to new mem
        !          6455: ;
        !          6456: : assign-bar-value32 ( bar size var -- 4 )
        !          6457: over IF                         \ IF size > 0
        !          6458: assign-var              \ | ( bar al-mem ) set variable to next mem
        !          6459: swap rtas-config-l!     \ | ( -- )         set the bar to al-mem
        !          6460: ELSE                            \ ELSE
        !          6461: 2drop drop              \ | clear stack
        !          6462: THEN                            \ FI
        !          6463: 4                               \ size of the base-address-register
        !          6464: ;
        !          6465: : assign-bar-value64 ( bar size var -- 8 )
        !          6466: over IF                         \ IF size > 0
        !          6467: assign-var              \ | ( bar al-mem ) set variable to next mem
        !          6468: swap                    \ | ( al-mem addr ) calc config-addr of this bar
        !          6469: 2dup rtas-config-l!     \ | ( al-mem addr ) set the Lower part of the bar to al-mem
        !          6470: 4 + swap 20 rshift      \ | ( al-mem>>32 addr ) prepare the upper part of the al-mem
        !          6471: swap rtas-config-l!     \ | ( -- ) and set the upper part of the bar
        !          6472: ELSE                            \ ELSE
        !          6473: 2drop drop              \ | clear stack
        !          6474: THEN                            \ FI
        !          6475: 8                               \ size of the base-address-register
        !          6476: ;
        !          6477: : assign-mem64-bar ( bar-addr -- 8 )
        !          6478: dup pci-bar-size-mem64         \ fetch size
        !          6479: pci-next-mem                    \ var to change
        !          6480: assign-bar-value64              \ and set it all
        !          6481: ;
        !          6482: : assign-mem32-bar ( bar-addr -- 4 )
        !          6483: dup pci-bar-size-mem32          \ fetch size
        !          6484: pci-next-mem                    \ var to change
        !          6485: assign-bar-value32              \ and set it all
        !          6486: ;
        !          6487: : assign-mmio64-bar ( bar-addr -- 8 )
        !          6488: dup pci-bar-size-mem64          \ fetch size
        !          6489: pci-next-mmio                   \ var to change
        !          6490: assign-bar-value64              \ and set it all
        !          6491: ;
        !          6492: : assign-mmio32-bar ( bar-addr -- 4 )
        !          6493: dup pci-bar-size-mem32          \ fetch size
        !          6494: pci-next-mmio                   \ var to change
        !          6495: assign-bar-value32              \ and set it all
        !          6496: ;
        !          6497: : assign-io-bar ( bar-addr -- 4 )
        !          6498: dup pci-bar-size-io             \ fetch size
        !          6499: pci-next-io                     \ var to change
        !          6500: assign-bar-value32              \ and set it all
        !          6501: ;
        !          6502: : assign-rom-bar ( bar-addr -- )
        !          6503: dup pci-bar-size-rom            \ fetch size
        !          6504: dup IF                          \ IF size > 0
        !          6505: over >r                 \ | save bar addr for enable
        !          6506: pci-next-mmio           \ | var to change
        !          6507: assign-bar-value32      \ | and set it
        !          6508: drop                    \ | forget the BAR length
        !          6509: r@ rtas-config-l@       \ | fetch BAR
        !          6510: 1 or r> rtas-config-l!  \ | and enable the ROM
        !          6511: ELSE                            \ ELSE
        !          6512: 2drop                   \ | clear stack
        !          6513: THEN
        !          6514: ;
        !          6515: : assign-bar ( bar-addr -- reg-size )
        !          6516: dup pci-bar-code@                       \ calc BAR type
        !          6517: dup IF                                  \ IF >0
        !          6518: CASE                            \ | CASE Setup the right type
        !          6519: 1 OF assign-io-bar     ENDOF    \ | - set up an IO-Bar
        !          6520: 2 OF assign-mmio32-bar ENDOF    \ | - set up an 32bit MMIO-Bar
        !          6521: 3 OF assign-mem32-bar  ENDOF    \ | - set up an 32bit MEM-Bar (prefetchable)
        !          6522: 4 OF assign-mmio64-bar ENDOF    \ | - set up an 64bit MMIO-Bar
        !          6523: 5 OF assign-mem64-bar  ENDOF    \ | - set up an 64bit MEM-Bar (prefetchable)
        !          6524: ENDCASE                         \ | ESAC
        !          6525: ELSE                                    \ ELSE
        !          6526: ABORT                           \ | Throw an exception
        !          6527: THEN                                    \ FI
        !          6528: ;
        !          6529: : assign-all-device-bars ( configaddr -- )
        !          6530: 28 10 DO                        \ BARs start at 10 and end at 27
        !          6531: dup i +                 \ calc config-addr of the BAR
        !          6532: assign-bar              \ and set it up
        !          6533: +LOOP                           \ add 4 or 8 to the index and loop
        !          6534: 30 + assign-rom-bar             \ set up the ROM if available
        !          6535: ;
        !          6536: : assign-all-bridge-bars ( configaddr -- )
        !          6537: 18 10 DO                        \ BARs start at 10 and end at 17
        !          6538: dup i +                 \ calc config-addr of the BAR
        !          6539: assign-bar              \ and set it up
        !          6540: +LOOP                           \ add 4 or 8 to the index and loop
        !          6541: 38 + assign-rom-bar             \ set up the ROM if available
        !          6542: ;
        !          6543: : gen-mem64-bar-prop ( prop-addr prop-len bar-addr -- prop-addr prop-len 8 )
        !          6544: dup pci-bar-size-mem64                  \ fetch BAR Size        ( paddr plen baddr bsize )
        !          6545: dup IF                                  \ IF Size > 0
        !          6546: >r dup rtas-config-l@           \ | save size and fetch lower 32 bits ( paddr plen baddr val.lo R: size)
        !          6547: over 4 + rtas-config-l@         \ | fetch upper 32 bits               ( paddr plen baddr val.lo val.hi R: size)
        !          6548: 20 lshift + -10 and >r          \ | calc 64 bit value and save it     ( paddr plen baddr R: size val )
        !          6549: 83000000 or encode-int+         \ | Encode config addr                ( paddr plen R: size val )
        !          6550: r> encode-64+                   \ | Encode assigned addr              ( paddr plen R: size )
        !          6551: r> encode-64+                   \ | Encode size                       ( paddr plen )
        !          6552: ELSE                                    \ ELSE
        !          6553: 2drop                           \ | don't do anything
        !          6554: THEN                                    \ FI
        !          6555: 8                                       \ sizeof(BAR) = 8 Bytes
        !          6556: ;
        !          6557: : gen-pmem64-bar-prop ( prop-addr prop-len bar-addr -- prop-addr prop-len 8 )
        !          6558: dup pci-bar-size-mem64                  \ fetch BAR Size        ( paddr plen baddr bsize )
        !          6559: dup IF                                  \ IF Size > 0
        !          6560: >r dup rtas-config-l@           \ | save size and fetch lower 32 bits ( paddr plen baddr val.lo R: size)
        !          6561: over 4 + rtas-config-l@         \ | fetch upper 32 bits               ( paddr plen baddr val.lo val.hi R: size)
        !          6562: 20 lshift + -10 and >r          \ | calc 64 bit value and save it     ( paddr plen baddr R: size val )
        !          6563: C3000000 or encode-int+         \ | Encode config addr                ( paddr plen R: size val )
        !          6564: r> encode-64+                   \ | Encode assigned addr              ( paddr plen R: size )
        !          6565: r> encode-64+                   \ | Encode size                       ( paddr plen )
        !          6566: ELSE                                    \ ELSE
        !          6567: 2drop                           \ | don't do anything
        !          6568: THEN                                    \ FI
        !          6569: 8                                       \ sizeof(BAR) = 8 Bytes
        !          6570: ;
        !          6571: : gen-mem32-bar-prop ( prop-addr prop-len bar-addr -- prop-addr prop-len 4 )
        !          6572: dup pci-bar-size-mem32                  \ fetch BAR Size        ( paddr plen baddr bsize )
        !          6573: dup IF                                  \ IF Size > 0
        !          6574: >r dup rtas-config-l@           \ | save size and fetch value         ( paddr plen baddr val R: size)
        !          6575: -10 and >r                      \ | calc 32 bit value and save it     ( paddr plen baddr R: size val )
        !          6576: 82000000 or encode-int+         \ | Encode config addr                ( paddr plen R: size val )
        !          6577: r> encode-64+                   \ | Encode assigned addr              ( paddr plen R: size )
        !          6578: r> encode-64+                   \ | Encode size                       ( paddr plen )
        !          6579: ELSE                                    \ ELSE
        !          6580: 2drop                           \ | don't do anything
        !          6581: THEN                                    \ FI
        !          6582: 4                                       \ sizeof(BAR) = 4 Bytes
        !          6583: ;
        !          6584: : gen-pmem32-bar-prop ( prop-addr prop-len bar-addr -- prop-addr prop-len 4 )
        !          6585: dup pci-bar-size-mem32                  \ fetch BAR Size        ( paddr plen baddr bsize )
        !          6586: dup IF                                  \ IF Size > 0
        !          6587: >r dup rtas-config-l@           \ | save size and fetch value         ( paddr plen baddr val R: size)
        !          6588: -10 and >r                      \ | calc 32 bit value and save it     ( paddr plen baddr R: size val )
        !          6589: C2000000 or encode-int+         \ | Encode config addr                ( paddr plen R: size val )
        !          6590: r> encode-64+                   \ | Encode assigned addr              ( paddr plen R: size )
        !          6591: r> encode-64+                   \ | Encode size                       ( paddr plen )
        !          6592: ELSE                                    \ ELSE
        !          6593: 2drop                           \ | don't do anything
        !          6594: THEN                                    \ FI
        !          6595: 4                                       \ sizeof(BAR) = 4 Bytes
        !          6596: ;
        !          6597: : gen-io-bar-prop ( prop-addr prop-len bar-addr -- prop-addr prop-len 4 )
        !          6598: dup pci-bar-size-io                     \ fetch BAR Size                      ( paddr plen baddr bsize )
        !          6599: dup IF                                  \ IF Size > 0
        !          6600: >r dup rtas-config-l@           \ | save size and fetch value         ( paddr plen baddr val R: size)
        !          6601: -4 and >r                       \ | calc 32 bit value and save it     ( paddr plen baddr R: size val )
        !          6602: 81000000 or encode-int+         \ | Encode config addr                ( paddr plen R: size val )
        !          6603: r> encode-64+                   \ | Encode assigned addr              ( paddr plen R: size )
        !          6604: r> encode-64+                   \ | Encode size                       ( paddr plen )
        !          6605: ELSE                                    \ ELSE
        !          6606: 2drop                           \ | don't do anything
        !          6607: THEN                                    \ FI
        !          6608: 4                                       \ sizeof(BAR) = 4 Bytes
        !          6609: ;
        !          6610: : gen-rom-bar-prop ( prop-addr prop-len bar-addr -- prop-addr prop-len )
        !          6611: dup pci-bar-size-rom                    \ fetch BAR Size                      ( paddr plen baddr bsize )
        !          6612: dup IF                                  \ IF Size > 0
        !          6613: >r dup rtas-config-l@           \ | save size and fetch value         ( paddr plen baddr val R: size)
        !          6614: FFFFF800 and >r                 \ | calc 32 bit value and save it     ( paddr plen baddr R: size val )
        !          6615: 82000000 or encode-int+         \ | Encode config addr                ( paddr plen R: size val )
        !          6616: r> encode-64+                   \ | Encode assigned addr              ( paddr plen R: size )
        !          6617: r> encode-64+                   \ | Encode size                       ( paddr plen )
        !          6618: ELSE                                    \ ELSE
        !          6619: 2drop                           \ | don't do anything
        !          6620: THEN                                    \ FI
        !          6621: ;
        !          6622: : pci-add-assigned-address ( prop-addr prop-len bar-addr -- prop-addr prop-len bsize )
        !          6623: dup pci-bar-code@                               \ calc BAR type                         ( paddr plen baddr btype)
        !          6624: CASE                                            \ CASE for the BAR types                ( paddr plen baddr )
        !          6625: 0 OF drop 4              ENDOF          \ - not a valid type so do nothing
        !          6626: 1 OF gen-io-bar-prop     ENDOF          \ - IO-BAR
        !          6627: 2 OF gen-mem32-bar-prop  ENDOF          \ - MEM32
        !          6628: 3 OF gen-pmem32-bar-prop ENDOF          \ - MEM32 prefetchable
        !          6629: 4 OF gen-mem64-bar-prop  ENDOF          \ - MEM64
        !          6630: 5 OF gen-pmem64-bar-prop ENDOF          \ - MEM64 prefetchable
        !          6631: ENDCASE                                         \ ESAC ( paddr plen bsize )
        !          6632: ;
        !          6633: : pci-device-assigned-addresses-prop ( addr -- )
        !          6634: encode-start                                    \ provide mem for property              ( addr paddr plen )
        !          6635: 2 pick 30 + gen-rom-bar-prop                    \ assign the rom bar
        !          6636: 28 10 DO                                        \ we have 6 possible BARs
        !          6637: 2 pick i +                              \ calc BAR address                      ( addr paddr plen bar-addr )      
        !          6638: pci-add-assigned-address                \ and generate the props for the BAR
        !          6639: +LOOP                                           \ increase Index by returned len
        !          6640: s" assigned-addresses" property drop            \ and write it into the device tree
        !          6641: ;
        !          6642: : pci-bridge-assigned-addresses-prop ( addr -- )
        !          6643: encode-start                                    \ provide mem for property
        !          6644: 2 pick 38 + gen-rom-bar-prop                    \ assign the rom bar
        !          6645: 18 10 DO                                        \ we have 2 possible BARs
        !          6646: 2 pick i +                              \ ( addr paddr plen current-addr )
        !          6647: pci-add-assigned-address                \ and generate the props for the BAR
        !          6648: +LOOP                                           \ increase Index by returned len
        !          6649: s" assigned-addresses" property drop            \ and write it into the device tree
        !          6650: ;
        !          6651: : pci-bridge-gen-range ( paddr plen base limit type -- paddr plen )
        !          6652: >r over -                       \ calc size             ( paddr plen base size R:type )
        !          6653: dup 0< IF                       \ IF Size < 0           ( paddr plen base size R:type )
        !          6654: 2drop r> drop           \ | forget values       ( paddr plen )
        !          6655: ELSE                            \ ELSE
        !          6656: 1+ swap 2swap           \ | adjust stack        ( size base paddr plen R:type )
        !          6657: r@ encode-int+          \ | Child type          ( size base paddr plen R:type )
        !          6658: 2 pick encode-64+       \ | Child address       ( size base paddr plen R:type )
        !          6659: r> encode-int+          \ | Parent type         ( size base paddr plen )
        !          6660: rot encode-64+          \ | Parent address      ( size paddr plen )
        !          6661: rot encode-64+          \ | Encode size         ( paddr plen )
        !          6662: THEN                            \ FI
        !          6663: ;
        !          6664: : pci-bridge-gen-mmio-range ( addr prop-addr prop-len -- addr prop-addr prop-len )
        !          6665: 2 pick 20 + rtas-config-l@      \ fetch Value           ( addr paddr plen val )
        !          6666: dup 0000FFF0 and 10 lshift      \ calc base-address     ( addr paddr plen val base )
        !          6667: swap 000FFFFF or                \ calc limit-address    ( addr paddr plen base limit )
        !          6668: 02000000 pci-bridge-gen-range   \ and generate it       ( addr paddr plen )
        !          6669: ;
        !          6670: : pci-bridge-gen-mem-range ( addr prop-addr prop-len -- addr prop-addr prop-len )
        !          6671: 2 pick 24 + rtas-config-l@      \ fetch Value           ( addr paddr plen val )
        !          6672: dup 000FFFFF or                 \ calc limit Bits 31:0  ( addr paddr plen val limit.31:0 )
        !          6673: swap 0000FFF0 and 10 lshift     \ calc base Bits 31:0   ( addr paddr plen limit.31:0 base.31:0 )
        !          6674: 4 pick 28 + rtas-config-l@      \ fetch upper Basebits  ( addr paddr plen limit.31:0 base.31:0 base.63:32 )
        !          6675: 20 lshift or swap               \ and calc Base         ( addr paddr plen base.63:0 limit.31:0 )
        !          6676: 4 pick 2C + rtas-config-l@      \ fetch upper Limitbits ( addr paddr plen base.63:0 limit.31:0 limit.63:32 )
        !          6677: 20 lshift or                    \ and calc Limit        ( addr paddr plen base.63:0 limit.63:0 )
        !          6678: 42000000 pci-bridge-gen-range   \ and generate it       ( addr paddr plen )
        !          6679: ;
        !          6680: : pci-bridge-gen-io-range ( addr prop-addr prop-len -- addr prop-addr prop-len )
        !          6681: 2 pick 1C + rtas-config-l@      \ fetch Value           ( addr paddr plen val )
        !          6682: dup 0000F000 and 00000FFF or    \ calc Limit Bits 15:0  ( addr paddr plen val limit.15:0 )
        !          6683: swap 000000F0 and 8 lshift      \ calc Base Bits 15:0   ( addr paddr plen limit.15:0 base.15:0 )
        !          6684: 4 pick 30 + rtas-config-l@      \ fetch upper Bits      ( addr paddr plen limit.15:0 base.15:0 val )
        !          6685: dup FFFF and 10 lshift rot or   \ calc Base             ( addr paddr plen limit.15:0 val base.31:0 )
        !          6686: -rot FFFF0000 and or            \ calc Limit            ( addr paddr plen base.31:0 limit.31:0 )
        !          6687: 01000000 pci-bridge-gen-range   \ and generate it       ( addr paddr plen )
        !          6688: ;
        !          6689: : pci-bridge-range-props ( addr -- )
        !          6690: encode-start                    \ provide mem for property
        !          6691: pci-bridge-gen-mmio-range       \ generate the non prefetchable Memory Entry
        !          6692: pci-bridge-gen-mem-range        \ generate the prefetchable Memory Entry
        !          6693: pci-bridge-gen-io-range         \ generate the IO Entry
        !          6694: dup IF                          \ IF any space present (propsize>0)
        !          6695: s" ranges" property     \ | write it into the device tree
        !          6696: ELSE                            \ ELSE
        !          6697: 2drop                   \ | forget the properties
        !          6698: THEN                            \ FI
        !          6699: drop                            \ forget the address
        !          6700: ;
        !          6701: : pci-bridge-interrupt-map ( -- )
        !          6702: encode-start                                    \ create the property                           ( paddr plen )
        !          6703: get-node child                                  \ find the first child                          ( paddr plen handle )
        !          6704: BEGIN dup WHILE                                 \ Loop as long as the handle is non-zero        ( paddr plen handle )
        !          6705: dup >r >space                           \ Get the my-space                              ( paddr plen addr R: handle )
        !          6706: pci-gen-irq-entry                       \ and Encode the interrupt settings             ( paddr plen R: handle)
        !          6707: r> peer                                 \ Get neighbour                                 ( paddr plen handle )
        !          6708: REPEAT                                          \ process next childe node                      ( paddr plen handle )
        !          6709: drop                                            \ forget the null                               ( paddr plen )
        !          6710: s" interrupt-map" property                      \ and set it                                    ( -- )
        !          6711: 1 encode-int s" #interrupt-cells" property      \ encode the cell#
        !          6712: f800 encode-int 0 encode-int+ 0 encode-int+     \ encode the bit mask for config addr (Dev only)
        !          6713: 7 encode-int+ s" interrupt-map-mask" property   \ encode IRQ#=7 and generate property
        !          6714: ;
        !          6715: : encode-mem32-bar ( prop-addr prop-len BAR-addr -- prop-addr prop-len 4 )
        !          6716: dup pci-bar-size-mem32                  \ calc BAR-size ( not changing the BAR )
        !          6717: dup IF                                  \ IF BAR-size > 0       ( paddr plen baddr bsize )
        !          6718: >r 02000000 or encode-int+      \ | save size and encode BAR addr
        !          6719: 0 encode-64+                    \ | make mid and lo zero
        !          6720: r> encode-64+                   \ | encode size
        !          6721: ELSE                                    \ ELSE
        !          6722: 2drop                           \ | don't do anything
        !          6723: THEN                                    \ FI
        !          6724: 4                                       \ BAR-Len = 4 (32Bit)
        !          6725: ;
        !          6726: : encode-pmem32-bar ( prop-addr prop-len BAR-addr -- prop-addr prop-len 4 )
        !          6727: dup pci-bar-size-mem32                  \ calc BAR-size ( not changing the BAR )
        !          6728: dup IF                                  \ IF BAR-size > 0       ( paddr plen baddr bsize )
        !          6729: >r 42000000 or encode-int+      \ | save size and encode BAR addr
        !          6730: 0 encode-64+                    \ | make mid and lo zero
        !          6731: r> encode-64+                   \ | encode size
        !          6732: ELSE                                    \ ELSE
        !          6733: 2drop                           \ | don't do anything
        !          6734: THEN                                    \ FI
        !          6735: 4                                       \ BAR-Len = 4 (32Bit)
        !          6736: ;
        !          6737: : encode-mem64-bar ( prop-addr prop-len BAR-addr -- prop-addr prop-len 8 )
        !          6738: dup pci-bar-size-mem64                  \ calc BAR-size ( not changing the BAR )
        !          6739: dup IF                                  \ IF BAR-size > 0       ( paddr plen baddr bsize )
        !          6740: >r 03000000 or encode-int+      \ | save size and encode BAR addr
        !          6741: 0 encode-64+                    \ | make mid and lo zero
        !          6742: r> encode-64+                   \ | encode size
        !          6743: ELSE                                    \ ELSE
        !          6744: 2drop                           \ | don't do anything
        !          6745: THEN                                    \ FI
        !          6746: 8                                       \ BAR-Len = 8 (64Bit)
        !          6747: ;
        !          6748: : encode-pmem64-bar ( prop-addr prop-len BAR-addr -- prop-addr prop-len 8 )
        !          6749: dup pci-bar-size-mem64                  \ calc BAR-size ( not changing the BAR )
        !          6750: dup IF                                  \ IF BAR-size > 0       ( paddr plen baddr bsize )
        !          6751: >r 43000000 or encode-int+      \ | save size and encode BAR addr
        !          6752: 0 encode-64+                    \ | make mid and lo zero
        !          6753: r> encode-64+                   \ | encode size
        !          6754: ELSE                                    \ ELSE
        !          6755: 2drop                           \ | don't do anything
        !          6756: THEN                                    \ FI
        !          6757: 8                                       \ BAR-Len = 8 (64Bit)
        !          6758: ;
        !          6759: : encode-rom-bar ( prop-addr prop-len configaddr -- prop-addr prop-len )
        !          6760: dup pci-bar-size-rom                            \ fetch raw BAR-size
        !          6761: dup IF                                          \ IF BAR is used
        !          6762: >r 02000000 or encode-int+              \ | save size and encode BAR addr
        !          6763: 0 encode-64+                            \ | make mid and lo zero
        !          6764: r> encode-64+                           \ | calc and encode the size
        !          6765: ELSE                                            \ ELSE
        !          6766: 2drop                                   \ | don't do anything
        !          6767: THEN                                            \ FI
        !          6768: ;
        !          6769: : encode-io-bar ( prop-addr prop-len BAR-addr BAR-value -- prop-addr prop-len 4 )
        !          6770: dup pci-bar-size-io                     \ calc BAR-size ( not changing the BAR )
        !          6771: dup IF                                  \ IF BAR-size > 0       ( paddr plen baddr bsize )
        !          6772: >r 01000000 or encode-int+      \ | save size and encode BAR addr
        !          6773: 0 encode-64+                    \ | make mid and lo zero
        !          6774: r> encode-64+                   \ | encode size
        !          6775: ELSE                                    \ ELSE
        !          6776: 2drop                           \ | don't do anything
        !          6777: THEN                                    \ FI
        !          6778: 4                                       \ BAR-Len = 4 (32Bit)
        !          6779: ;
        !          6780: : encode-bar ( prop-addr prop-len bar-addr -- prop-addr prop-len bar-len )
        !          6781: dup pci-bar-code@                               \ calc BAR type
        !          6782: CASE                                            \ CASE for the BAR types ( paddr plen baddr val )
        !          6783: 0 OF drop 4             ENDOF           \ - not a valid type so do nothing
        !          6784: 1 OF encode-io-bar      ENDOF           \ - IO-BAR
        !          6785: 2 OF encode-mem32-bar   ENDOF           \ - MEM32
        !          6786: 3 OF encode-pmem32-bar  ENDOF           \ - MEM32 prefetchable
        !          6787: 4 OF encode-mem64-bar   ENDOF           \ - MEM64
        !          6788: 5 OF encode-pmem64-bar  ENDOF           \ - MEM64 prefetchable
        !          6789: ENDCASE                                         \ ESAC ( paddr plen blen )
        !          6790: ;
        !          6791: : pci-reg-props ( configaddr -- )
        !          6792: dup encode-int                  \ configuration space           ( caddr paddr plen )
        !          6793: 0 encode-64+                    \ make the rest 0
        !          6794: 0 encode-64+                    \ encode the size as 0
        !          6795: 2 pick pci-htype@               \ fetch Header Type             ( caddr paddr plen type )
        !          6796: 1 and IF                        \ IF Bridge                     ( caddr paddr plen )
        !          6797: 18 10 DO                \ | loop over all BARs
        !          6798: 2 pick i +      \ | calc bar-addr               ( caddr paddr plen baddr )
        !          6799: encode-bar      \ | encode this BAR             ( caddr paddr plen blen )
        !          6800: +LOOP              \ | increase LoopIndex by the BARlen
        !          6801: 2 pick 38 +             \ | calc ROM-BAR for a bridge   ( caddr paddr plen baddr )
        !          6802: encode-rom-bar          \ | encode the ROM-BAR          ( caddr paddr plen )
        !          6803: ELSE                            \ ELSE ordinary device          ( caddr paddr plen )
        !          6804: 28 10 DO                 \ | loop over all BARs
        !          6805: 2 pick i +      \ | calc bar-addr               ( caddr paddr plen baddr )
        !          6806: encode-bar      \ | encode this BAR             ( caddr paddr plen blen )
        !          6807: +LOOP              \ | increase LoopIndex by the BARlen
        !          6808: 2 pick 30 +             \ | calc ROM-BAR for a device   ( caddr paddr plen baddr )
        !          6809: encode-rom-bar          \ | encode the ROM-BAR          ( caddr paddr plen )
        !          6810: THEN                            \ FI                            ( caddr paddr plen )
        !          6811: s" reg" property                \ and store it into the property
        !          6812: drop
        !          6813: ;
        !          6814: : pci-common-props ( addr -- )
        !          6815: dup pci-class-name 2dup device-name device-type
        !          6816: dup pci-vendor@    encode-int s" vendor-id"      property
        !          6817: dup pci-device@    encode-int s" device-id"      property
        !          6818: dup pci-revision@  encode-int s" revision-id"    property
        !          6819: dup pci-class@     encode-int s" class-code"     property
        !          6820: 3 encode-int s" #address-cells" property
        !          6821: 2 encode-int s" #size-cells"    property
        !          6822: dup pci-config-ext? IF 1 encode-int s" ibm,pci-config-space-type" property THEN
        !          6823: dup pci-status@
        !          6824: dup 9 rshift 3 and encode-int s" devsel-speed" property
        !          6825: dup 7 rshift 1 and IF 0 0 s" fast-back-to-back" property THEN
        !          6826: dup 6 rshift 1 and IF 0 0 s" 66mhz-capable" property THEN
        !          6827: 5 rshift 1 and IF 0 0 s" udf-supported" property THEN
        !          6828: dup pci-cache@     ?dup IF encode-int s" cache-line-size" property THEN
        !          6829: pci-interrupt@ ?dup IF encode-int s" interrupts"      property THEN
        !          6830: ;
        !          6831: : pci-device-props ( addr -- )
        !          6832: dup pci-common-props
        !          6833: dup pci-min-grant@ encode-int s" min-grant"   property
        !          6834: dup pci-max-lat@   encode-int s" max-latency" property
        !          6835: dup pci-sub-device@ ?dup IF encode-int s" subsystem-id" property THEN
        !          6836: dup pci-sub-vendor@ ?dup IF encode-int s" subsystem-vendor-id" property THEN
        !          6837: dup pci-device-assigned-addresses-prop
        !          6838: pci-reg-props
        !          6839: ;
        !          6840: : pci-bridge-props ( addr -- )
        !          6841: dup pci-bus@
        !          6842: encode-int s" primary-bus" property
        !          6843: encode-int s" secondary-bus" property
        !          6844: encode-int s" subordinate-bus" property
        !          6845: dup pci-bus@ drop encode-int rot encode-int+ s" bus-range" property
        !          6846: pci-device-slots encode-int s" slot-names" property
        !          6847: dup pci-bridge-range-props
        !          6848: dup pci-bridge-assigned-addresses-prop
        !          6849: s" interrupt-map" get-node get-property IF
        !          6850: pci-bridge-interrupt-map
        !          6851: ELSE 2drop THEN
        !          6852: pci-reg-props
        !          6853: ;
        !          6854: : assign-bar-mapping ( bar-offset size var -- )
        !          6855: rot my-unit-64 + -rot
        !          6856: assign-bar-value32 drop
        !          6857: ;
        !          6858: : assigned-addresses-property (  -- )
        !          6859: my-unit-64
        !          6860: dup pci-common-props
        !          6861: pci-device-assigned-addresses-prop
        !          6862: ;
        !          6863: : pci-bridge-generic-setup ( addr -- )
        !          6864: pci-device-slots >r             \ save the slot array on return stack
        !          6865: dup pci-common-props            \ set the common properties before scanning the bus
        !          6866: s" pci" device-type             \ the type is allways "pci"
        !          6867: dup pci-bridge-probe            \ find all device connected to it
        !          6868: dup assign-all-bridge-bars      \ set up all memory access BARs
        !          6869: dup pci-set-irq-line            \ set the interrupt pin
        !          6870: dup pci-set-capabilities        \ set up the capabilities
        !          6871: pci-bridge-props            \ and generate all properties
        !          6872: r> TO pci-device-slots          \ and reset the slot array
        !          6873: ;
        !          6874: : pci-device-generic-setup ( config-addr -- )
        !          6875: dup assign-all-device-bars      \ calc all BARs
        !          6876: dup pci-set-irq-line            \ set the interrupt pin
        !          6877: dup pci-set-capabilities        \ set up the capabilities
        !          6878: dup pci-device-props            \ and generate all properties
        !          6879: drop                            \ forget the config-addr
        !          6880: ;
        !          6881: : populate-pci-busses ( -- )
        !          6882: " /" find-device get-node child
        !          6883: BEGIN
        !          6884: dup 0 <>
        !          6885: WHILE
        !          6886: dup set-node
        !          6887: dup " name" rot get-package-property 0 = IF
        !          6888: drop dup from-cstring
        !          6889: 2dup s" pci" strequal IF
        !          6890: s" pci-phb.fs" included
        !          6891: THEN
        !          6892: 2drop
        !          6893: THEN
        !          6894: peer
        !          6895: REPEAT drop
        !          6896: device-end
        !          6897: ;
        !          6898: populate-pci-busses
        !          6899: 600 cp
        !          6900: ' rtas-quiesce add-quiesce-xt
        !          6901: 640 cp
        !          6902: 690 cp
        !          6903: 6a0 cp
        !          6904: 6a8 cp
        !          6905: 6b0 cp
        !          6906: 6b8 cp
        !          6907: 6c0 cp
        !          6908: s" /cpus/@0" open-dev encode-int s" cpu" set-chosen
        !          6909: s" /memory" open-dev encode-int s" memory" set-chosen
        !          6910: 6e0 cp
        !          6911: 700 cp
        !          6912: s" /openprom" find-device
        !          6913: s" SLOF," slof-build-id here swap rmove here slof-build-id nip $cat encode-string s" model" property
        !          6914: 0 0 s" relative-addressing" property
        !          6915: device-end
        !          6916: s" /aliases" find-device
        !          6917: : open  true ;
        !          6918: : close ;
        !          6919: device-end
        !          6920: s" /mmu" open-dev encode-int s" mmu" set-chosen
        !          6921: VARIABLE chosen-memory-ih 0 chosen-memory-ih !
        !          6922: : (chosen-memory-ph) ( -- phandle )
        !          6923: chosen-memory-ih @ ?dup 0= IF
        !          6924: s" memory" get-chosen IF
        !          6925: decode-int nip nip dup chosen-memory-ih !
        !          6926: ihandle>phandle
        !          6927: ELSE 0 THEN
        !          6928: ELSE ihandle>phandle THEN
        !          6929: ;
        !          6930: : (set-available-prop) ( prop plen -- )
        !          6931: s" available"
        !          6932: (chosen-memory-ph) ?dup 0<> IF set-property ELSE
        !          6933: cr ." Can't find chosen memory node - "
        !          6934: ." no available property created" cr
        !          6935: 2dup 2dup
        !          6936: THEN
        !          6937: ;
        !          6938: : update-available-property ( available-ptr -- )
        !          6939: dup >r available>size@
        !          6940: 0= r@ available AVAILABLE-SIZE /available * + >= or IF
        !          6941: available r> available - encode-bytes (set-available-prop)
        !          6942: ELSE
        !          6943: r> /available + RECURSE
        !          6944: THEN
        !          6945: ;
        !          6946: : update-available-property available update-available-property ;
        !          6947: : claim ( [ addr ] len align -- base ) claim update-available-property ;
        !          6948: : release ( addr len -- ) release update-available-property ;
        !          6949: update-available-property
        !          6950: : input  ( dev-str dev-len -- )
        !          6951: open-dev ?dup IF
        !          6952: s" stdin" get-chosen IF
        !          6953: decode-int nip nip ?dup IF close-dev THEN
        !          6954: THEN
        !          6955: encode-int s" stdin"  set-chosen
        !          6956: THEN
        !          6957: ;
        !          6958: : output  ( dev-str dev-len -- )
        !          6959: open-dev ?dup IF
        !          6960: s" stdout" get-chosen IF
        !          6961: decode-int nip nip ?dup IF close-dev THEN
        !          6962: THEN
        !          6963: encode-int s" stdout" set-chosen
        !          6964: THEN
        !          6965: ;
        !          6966: : io  ( dev-str dev-len -- )
        !          6967: 2dup input output
        !          6968: ;
        !          6969: 1 BUFFER: (term-io-char-buf)
        !          6970: : term-io-key  ( -- char )
        !          6971: s" stdin" get-chosen IF
        !          6972: decode-int nip nip dup 0= IF 0 EXIT THEN
        !          6973: >r BEGIN
        !          6974: (term-io-char-buf) 1 s" read" r@ $call-method
        !          6975: 0 >
        !          6976: UNTIL
        !          6977: (term-io-char-buf) c@
        !          6978: r> drop
        !          6979: THEN
        !          6980: ;
        !          6981: ' term-io-key to key
        !          6982: : term-io-key?  ( -- true|false )
        !          6983: s" stdin" get-chosen IF
        !          6984: decode-int nip nip dup 0= IF drop 0 EXIT THEN \ return false and exit if no stdin set
        !          6985: >r \ store ihandle on return stack
        !          6986: s" device_type" r@ ihandle>phandle ( propstr len phandle )
        !          6987: get-property ( true | data dlen false )
        !          6988: IF
        !          6989: false
        !          6990: ELSE
        !          6991: 1 - \ remove 1 from length to ignore null-termination char
        !          6992: 2dup s" serial" str= IF
        !          6993: 2drop serial-key? r> drop EXIT
        !          6994: THEN \ call serial-key, cleanup return-stack, exit
        !          6995: 2dup s" keyboard" str= IF 
        !          6996: 2drop ( )
        !          6997: s" key-available?" r@ ihandle>phandle find-method IF 
        !          6998: drop s" key-available?" r@ $call-method  
        !          6999: ELSE 
        !          7000: false 
        !          7001: THEN
        !          7002: r> drop EXIT \ cleanup return-stack, exit
        !          7003: THEN
        !          7004: 2drop r> drop false EXIT \ unknown device_type cleanup return-stack, return false
        !          7005: THEN
        !          7006: ELSE
        !          7007: false
        !          7008: THEN
        !          7009: ;
        !          7010: ' term-io-key? to key?
        !          7011: 800 cp
        !          7012: 51 CONSTANT nvram-partition-type-cpulog
        !          7013: 60 CONSTANT nvram-partition-type-sas
        !          7014: 61 CONSTANT nvram-partition-type-sms
        !          7015: 6e CONSTANT nvram-partition-type-debug
        !          7016: 6f CONSTANT nvram-partition-type-history
        !          7017: 70 CONSTANT nvram-partition-type-common
        !          7018: 7f CONSTANT nvram-partition-type-freespace
        !          7019: a0 CONSTANT nvram-partition-type-linux
        !          7020: : rztype ( str len -- ) \ stop at zero byte, read with nvram-c@
        !          7021: 0 DO
        !          7022: dup i + nvram-c@ ?dup IF ( str char )
        !          7023: emit
        !          7024: ELSE                     ( str )
        !          7025: drop UNLOOP EXIT
        !          7026: THEN
        !          7027: LOOP
        !          7028: ;
        !          7029: create tmpStr 500 allot
        !          7030: : rzcount ( zstr -- str len )
        !          7031: dup tmpStr >r BEGIN
        !          7032: dup nvram-c@ dup r> dup 1+ >r c!
        !          7033: WHILE
        !          7034: char+
        !          7035: REPEAT
        !          7036: r> drop over - swap drop tmpStr swap
        !          7037: ;
        !          7038: : calc-header-cksum ( offset -- cksum )
        !          7039: dup nvram-c@
        !          7040: 10 2 DO
        !          7041: over I + nvram-c@ +
        !          7042: LOOP
        !          7043: wbsplit + nip
        !          7044: ;
        !          7045: : bad-header? ( offset -- flag )
        !          7046: dup 2+ nvram-w@        ( offset length )
        !          7047: 0= IF                  ( offset )
        !          7048: drop true EXIT      ( )
        !          7049: THEN
        !          7050: dup calc-header-cksum  ( offset checksum' )
        !          7051: swap 1+ nvram-c@       ( checksum ' checksum )
        !          7052: <>                     ( flag )
        !          7053: ;
        !          7054: : .header ( offset -- )
        !          7055: cr                         ( offset )
        !          7056: dup bad-header? IF         ( offset )
        !          7057: ."   BAD HEADER -- trying to print it anyway" cr
        !          7058: THEN
        !          7059: space                      ( offset )
        !          7060: dup nvram-c@ 2 0.r         ( offset )
        !          7061: space space                ( offset )
        !          7062: dup 2+ nvram-w@ 10 * 5 .r  ( offset )
        !          7063: space space                ( offset )
        !          7064: 4 + 0c rztype              ( )
        !          7065: ;
        !          7066: : .headers ( -- )
        !          7067: cr cr ." Type  Size  Name"
        !          7068: cr ." ========================"
        !          7069: 0 BEGIN                      ( offset )
        !          7070: dup nvram-c@              ( offset type )
        !          7071: WHILE
        !          7072: dup .header               ( offset )
        !          7073: dup 2+ nvram-w@ 10 * +    ( offset offset' )
        !          7074: dup nvram-size < IF       ( offset )
        !          7075: ELSE
        !          7076: drop EXIT              ( )
        !          7077: THEN
        !          7078: REPEAT
        !          7079: drop                         ( )
        !          7080: cr cr
        !          7081: ;
        !          7082: : reset-nvram ( -- )
        !          7083: internal-reset-nvram
        !          7084: ;
        !          7085: : dump-partition     ['] nvram-c@      1 (dump) ;
        !          7086: : type-no-zero ( addr len -- )
        !          7087: 0 DO
        !          7088: dup I + dup nvram-c@ 0= IF drop ELSE nvram-c@ emit THEN
        !          7089: LOOP
        !          7090: drop
        !          7091: ;
        !          7092: : type-no-zero-part ( from-str cnt-str addr len )
        !          7093: 0 DO
        !          7094: dup i + dup nvram-c@ 0= IF
        !          7095: drop
        !          7096: ELSE
        !          7097: 3 pick 0= 3 pick 0 > AND IF
        !          7098: dup 1 type-no-zero
        !          7099: THEN
        !          7100: nvram-c@ a = IF
        !          7101: 2 pick 0= IF
        !          7102: over 1- 0 max
        !          7103: rot drop swap
        !          7104: THEN
        !          7105: 2 pick 1- 0 max
        !          7106: 3 roll drop rot rot
        !          7107: THEN
        !          7108: THEN
        !          7109: LOOP
        !          7110: drop
        !          7111: ;
        !          7112: : (dmesg-prepare) ( base-addr -- base-addr' addr len act-off )
        !          7113: 10 - \ go back to header
        !          7114: dup 14 + nvram-l@ dup >r
        !          7115: ( base-addr act-off ) ( R: act-off )
        !          7116: over over over + swap 10 + nvram-w@ + >r
        !          7117: ( base-addr act-off ) ( R:  act-off nvram-act-addr )
        !          7118: over 2 + nvram-w@ 10 * swap - over swap
        !          7119: ( base-addr base-addr start-size ) ( R:  act-off nvram-act-addr )
        !          7120: r> swap rot 10 + nvram-w@ - r>
        !          7121: ;
        !          7122: : .dmesg ( base-addr -- )
        !          7123: (dmesg-prepare) >r
        !          7124: cr type-no-zero
        !          7125: ( base-addr ) ( R: act-off )
        !          7126: dup 10 + nvram-w@ + r> type-no-zero
        !          7127: ;
        !          7128: : .dmesg-part ( from-str cnt-str base-addr -- )
        !          7129: (dmesg-prepare) >r
        !          7130: >r >r -rot r> r>
        !          7131: cr type-no-zero-part rot
        !          7132: ( base-addr ) ( R: act-off )
        !          7133: dup 10 + nvram-w@ + r> type-no-zero-part
        !          7134: ;
        !          7135: : dmesg-part ( from-str cnt-str -- left-from-str left-cnt-str )
        !          7136: 2dup
        !          7137: s" ibm,BE0log" get-named-nvram-partition IF
        !          7138: s" ibm,CPU0log" get-named-nvram-partition IF
        !          7139: 2drop EXIT
        !          7140: THEN
        !          7141: THEN
        !          7142: drop .dmesg-part nip nip
        !          7143: ;
        !          7144: : dmesg2 ( -- )
        !          7145: s" ibm,BE1log" get-named-nvram-partition IF
        !          7146: s" ibm,CPU1log" get-named-nvram-partition IF
        !          7147: ." No log partition." cr EXIT
        !          7148: THEN
        !          7149: THEN
        !          7150: drop .dmesg
        !          7151: ;
        !          7152: : dmesg ( -- )
        !          7153: s" ibm,BE0log" get-named-nvram-partition IF
        !          7154: s" ibm,CPU0log" get-named-nvram-partition IF
        !          7155: ." No log partition." cr EXIT
        !          7156: THEN
        !          7157: THEN
        !          7158: drop .dmesg
        !          7159: ;
        !          7160: 880 cp
        !          7161: wordlist CONSTANT envvars
        !          7162: : listenv  ( -- )
        !          7163: get-current envvars set-current  words  set-current
        !          7164: ;
        !          7165: : create-env ( "name" -- )
        !          7166: get-current  envvars set-current  CREATE  set-current
        !          7167: ;
        !          7168: : env-int     ( n -- )  1 c, align , DOES> char+ aligned @ ;
        !          7169: : env-bytes   ( a len -- )
        !          7170: 2 c, align dup , here swap dup allot move
        !          7171: DOES> char+ aligned dup @ >r cell+ r>
        !          7172: ;
        !          7173: : env-string  ( str len -- )  3 c, string, DOES> char+ count ;
        !          7174: : env-flag    ( f -- )  4 c, c, DOES> char+ c@ 0<> ;
        !          7175: : env-secmode ( sm -- )  5 c, c, DOES> char+ c@ ;
        !          7176: : default-int     ( n "name" -- )      create-env env-int ;
        !          7177: : default-bytes   ( a len "name" -- )  create-env env-bytes ;
        !          7178: : default-string  ( a len "name" -- )  create-env env-string ;
        !          7179: : default-flag    ( f "name" -- )      create-env env-flag ;
        !          7180: : default-secmode ( sm "name" -- )     create-env env-secmode ;
        !          7181: : set-option ( option-name len option len -- )
        !          7182: 2swap encode-string
        !          7183: 2swap s" /options" find-node dup IF set-property ELSE drop 2drop 2drop THEN
        !          7184: ;
        !          7185: : findenv ( name len -- adr def-adr type | 0 )
        !          7186: 2dup envvars voc-find dup 0<> IF ( ABORT" not a configuration variable" )
        !          7187: link> >body char+ >r (find-order) link> >body dup char+ swap c@ r> swap
        !          7188: ELSE
        !          7189: nip nip
        !          7190: THEN
        !          7191: ;
        !          7192: : test-flag ( param len -- true | false )
        !          7193: 2dup s" true" string=ci -rot s" false" string=ci or
        !          7194: ;
        !          7195: : test-secmode ( param len -- true | false )
        !          7196: 2dup s" none" string=ci -rot 2dup s" command" string=ci -rot s" full"
        !          7197: string=ci or or
        !          7198: ;
        !          7199: : test-int ( param len -- true | false )
        !          7200: drop c@ isdigit if true else false then ;
        !          7201: : findtype ( param len name len -- param len name len type )
        !          7202: 2dup findenv dup 0= \ try to find type of envvar
        !          7203: IF             \ no type found
        !          7204: drop 2swap
        !          7205: 2dup test-flag if 4 -rot else
        !          7206: 2dup test-secmode if 5 -rot else
        !          7207: 2dup test-int if 1 -rot else
        !          7208: 2dup test-string IF 3 ELSE 2 THEN  \ 3 = string, 2 = default to bytes
        !          7209: -rot then then then
        !          7210: rot
        !          7211: >r 2swap r>
        !          7212: else           \ take type from default value
        !          7213: nip nip
        !          7214: THEN
        !          7215: ;
        !          7216: : $setenv ( param len name len -- )
        !          7217: 4dup set-option
        !          7218: findtype dup 0=
        !          7219: IF
        !          7220: true ABORT" not a configuration variable"
        !          7221: ELSE
        !          7222: -rot $CREATE CASE
        !          7223: 1 OF evaluate env-int ENDOF \ XXX: wants decimal and 0x...
        !          7224: 2 OF
        !          7225: 2dup                    ( param len param len )
        !          7226: depth >r                ( param len param len  R: depth-before )
        !          7227: ['] evaluate CATCH IF   \ Catch 'unknown Forth words'...
        !          7228: 2drop  r> drop
        !          7229: env-string           \ and encode 'unknown word' as string
        !          7230: ELSE
        !          7231: depth r> = IF env-bytes ELSE env-int THEN
        !          7232: 2drop
        !          7233: THEN
        !          7234: ENDOF
        !          7235: 3 OF env-string ENDOF
        !          7236: 4 OF evaluate env-flag ENDOF
        !          7237: 5 OF evaluate env-secmode ENDOF \ XXX: recognize none, command, full
        !          7238: ENDCASE
        !          7239: THEN
        !          7240: ;
        !          7241: : (printenv) ( adr type -- )
        !          7242: CASE
        !          7243: 1 OF aligned @ . ENDOF
        !          7244: 2 OF aligned dup cell+ swap @ dup IF dump ELSE 2drop THEN ENDOF
        !          7245: 3 OF count type ENDOF
        !          7246: 4 OF c@ IF ." true" ELSE ." false" THEN ENDOF
        !          7247: 5 OF c@ . ENDOF \ XXX: print symbolically
        !          7248: ENDCASE
        !          7249: ;
        !          7250: : .printenv-header ( -- )
        !          7251: cr
        !          7252: s" ---environment variable--------current value-------------default value------"
        !          7253: type cr
        !          7254: ;
        !          7255: DEFER old-emit
        !          7256: 0 VALUE emit-counter
        !          7257: : emit-and-count emit-counter 1 + to emit-counter old-emit ;
        !          7258: : .enable-emit-counter
        !          7259: 0 to emit-counter
        !          7260: ['] emit behavior to old-emit
        !          7261: ['] emit-and-count to emit
        !          7262: ;
        !          7263: : .disable-emit-counter
        !          7264: ['] old-emit behavior to emit
        !          7265: ;
        !          7266: : .spaces
        !          7267: dup 0 > IF spaces ELSE
        !          7268: drop space THEN
        !          7269: ;
        !          7270: : .print-one-env
        !          7271: 3 .spaces
        !          7272: 2dup dup -rot type 1c swap - .spaces
        !          7273: findenv rot over
        !          7274: .enable-emit-counter
        !          7275: (printenv) .disable-emit-counter
        !          7276: 1a emit-counter - .spaces
        !          7277: (printenv)
        !          7278: ;
        !          7279: : .print-all-env
        !          7280: .printenv-header
        !          7281: envvars cell+ BEGIN @ dup WHILE dup link> >name
        !          7282: name>string .print-one-env cr REPEAT drop
        !          7283: ;
        !          7284: : printenv
        !          7285: parse-word dup 0= IF
        !          7286: 2drop .print-all-env ELSE findenv dup 0=
        !          7287: ABORT" not a configuration variable"
        !          7288: rot over cr ." Current: " (printenv)
        !          7289: cr ." Default: " (printenv) THEN
        !          7290: ;
        !          7291: : (set-default)  ( def-xt -- )
        !          7292: dup >name name>string $CREATE dup >body c@ >r execute r> CASE
        !          7293: 1 OF env-int ENDOF
        !          7294: 2 OF env-bytes ENDOF
        !          7295: 3 OF env-string ENDOF
        !          7296: 4 OF env-flag ENDOF
        !          7297: 5 OF env-secmode ENDOF ENDCASE
        !          7298: ;
        !          7299: true default-flag auto-boot?
        !          7300: s" " default-string boot-device
        !          7301: s" " default-string boot-file
        !          7302: s" boot" default-string boot-command
        !          7303: s" " default-string diag-device
        !          7304: s" " default-string diag-file
        !          7305: false default-flag diag-switch?
        !          7306: true default-flag fcode-debug?
        !          7307: s" " default-string input-device
        !          7308: s" " default-string nvramrc
        !          7309: s" " default-string oem-banner
        !          7310: false default-flag oem-banner?
        !          7311: 0 0 default-bytes oem-logo
        !          7312: false default-flag oem-logo?
        !          7313: s" " default-string output-device
        !          7314: 200 default-int screen-#columns
        !          7315: 200 default-int screen-#rows
        !          7316: 0 default-int security-#badlogins
        !          7317: 0 default-secmode security-mode
        !          7318: s" " default-string security-password
        !          7319: 0 default-int selftest-#megs
        !          7320: false default-flag use-nvramrc?
        !          7321: false default-flag direct-serial?
        !          7322: true default-flag real-mode?
        !          7323: true default-flag use-axon-ddr?
        !          7324: VARIABLE nvoff \ offset in envvar partition
        !          7325: : (nvupdate-one) ( adr type -- "value" )
        !          7326: CASE
        !          7327: 1 OF aligned @ (.) ENDOF
        !          7328: 2 OF drop s" 0 0" ENDOF
        !          7329: 3 OF count ENDOF
        !          7330: 4 OF c@ IF s" true" ELSE s" false" THEN ENDOF
        !          7331: 5 OF c@ (.) ENDOF \ XXX: print symbolically
        !          7332: ENDCASE
        !          7333: ;
        !          7334: : nvupdate-one   ( def-xt -- )
        !          7335: >r nvram-partition-type-common get-nvram-partition       ( part.addr part.len FALSE|TRUE R: def-xt )
        !          7336: ABORT" No valid NVRAM." r>      ( part.addr part.len def-xt )
        !          7337: >name name>string               ( part.addr part.len var.a var.l )
        !          7338: 2dup findenv nip (nvupdate-one)
        !          7339: internal-add-env
        !          7340: drop
        !          7341: ;
        !          7342: : (nvupdate) ( -- )
        !          7343: nvram-partition-type-common get-nvram-partition ABORT" No valid NVRAM."
        !          7344: erase-nvram-partition drop
        !          7345: envvars cell+
        !          7346: BEGIN @ dup WHILE dup link> nvupdate-one REPEAT
        !          7347: drop
        !          7348: ;
        !          7349: : nvupdate ( -- )
        !          7350: ." nvupdate is obsolete." cr
        !          7351: ;
        !          7352: : set-default
        !          7353: parse-word envvars voc-find
        !          7354: dup 0= ABORT" not a configuration variable" link> (set-default)
        !          7355: ;
        !          7356: : (set-defaults)
        !          7357: envvars cell+
        !          7358: BEGIN @ dup WHILE dup link> (set-default) REPEAT
        !          7359: drop
        !          7360: ;
        !          7361: (set-defaults)
        !          7362: : set-defaults
        !          7363: (set-defaults) (nvupdate)
        !          7364: ;
        !          7365: : setenv  parse-word ( skipws ) 0d parse -leading 2swap $setenv (nvupdate) ;
        !          7366: : get-nv  ( -- )
        !          7367: nvram-partition-type-common get-nvram-partition ( addr offset not-found | not-found ) \ find partition header
        !          7368: IF
        !          7369: ." No NVRAM common partition, re-initializing..." cr
        !          7370: internal-reset-nvram
        !          7371: (nvupdate)
        !          7372: nvram-partition-type-common get-nvram-partition IF ." NVRAM seems to be broken." cr EXIT THEN
        !          7373: THEN
        !          7374: drop ( addr )           \ throw away offset
        !          7375: BEGIN
        !          7376: dup rzcount  dup     \ make string from offset and make condition
        !          7377: WHILE                   ( offset offset length )
        !          7378: 2dup [char] = split  \ Split string at equal sign (=)
        !          7379: 2swap                ( offset offset length param len name len )
        !          7380: $setenv              \ Set envvar
        !          7381: nip                  \ throw away old string begin
        !          7382: + 1+                 \ calc new offset
        !          7383: REPEAT
        !          7384: 2drop drop              \ cleanup
        !          7385: ;
        !          7386: get-nv
        !          7387: : check-for-nvramrc  ( -- )
        !          7388: use-nvramrc?  IF
        !          7389: s" Executing following code from nvramrc: "
        !          7390: s" nvramrc" evaluate $cat
        !          7391: nvramlog-write-string-cr
        !          7392: s" (!) Executing code specified in nvramrc" type
        !          7393: cr s"  SLOF Setup = " type
        !          7394: .enable-emit-counter
        !          7395: s" nvramrc" evaluate ['] evaluate  CATCH  IF
        !          7396: 2drop
        !          7397: emit-counter 0  DO  8 emit  LOOP
        !          7398: s" (!) Code in nvramrc triggered exception. "
        !          7399: 2dup nvramlog-write-string
        !          7400: type cr 12 spaces s" Aborting nvramrc execution" 2dup
        !          7401: nvramlog-write-string-cr type cr
        !          7402: s"  SLOF Setup = " type
        !          7403: THEN
        !          7404: .disable-emit-counter
        !          7405: THEN
        !          7406: ;
        !          7407: : (nv-findalias) ( alias-ptr alias-len -- pos )
        !          7408: here 0
        !          7409: s" devalias " string-cat
        !          7410: 3 pick 3 pick string-cat
        !          7411: s"  " string-cat
        !          7412: s" nvramrc" evaluate
        !          7413: 2swap find-substr
        !          7414: nip nip
        !          7415: ;
        !          7416: : (nv-build-real-entry) ( name-ptr name-len dev-ptr dev-len -- str-ptr str-len )
        !          7417: 2swap here 0
        !          7418: s" devalias " string-cat
        !          7419: 2swap string-cat
        !          7420: s"  " string-cat
        !          7421: 2swap string-cat
        !          7422: 0d char-cat
        !          7423: 0a char-cat
        !          7424: ;
        !          7425: : (nv-build-null-entry) ( name-ptr name-len dev-ptr dev-len -- str-ptr str-len )
        !          7426: 4drop here 0
        !          7427: ;
        !          7428: : (nv-build-nvramrc) ( name-str name-len dev-str dev-len xt-build-entry -- )
        !          7429: 4 pick 4 pick (nv-findalias)
        !          7430: dup s" nvramrc" evaluate nip >= IF
        !          7431: drop execute
        !          7432: s" nvramrc" evaluate string-cat
        !          7433: dup allot
        !          7434: s" nvramrc" $setenv
        !          7435: ELSE  \ if our alias is still defined in nvramrc
        !          7436: 5 pick 5 pick 5 pick 5 pick 5 pick execute nip over +
        !          7437: s" nvramrc" evaluate 3 pick string-at
        !          7438: 2dup find-nextline string-at nip +
        !          7439: alloc-mem 0
        !          7440: s" nvramrc" evaluate drop 3 pick string-cat
        !          7441: rot >r >r >r execute r> r> 2swap string-cat
        !          7442: ( mem, len ) ( R: alias-pos )
        !          7443: s" nvramrc" evaluate r> string-at
        !          7444: 2dup find-nextline string-at string-cat
        !          7445: 2dup s" nvramrc" $setenv free-mem
        !          7446: THEN
        !          7447: ;
        !          7448: : $nvalias ( name-str name-len dev-str dev-len -- )
        !          7449: 4dup ['] (nv-build-real-entry) (nv-build-nvramrc)
        !          7450: set-alias
        !          7451: s" true" s" use-nvramrc?" $setenv
        !          7452: (nvupdate)
        !          7453: ;
        !          7454: : nvalias ( "alias-name< >device-specifier<eol>" -- )
        !          7455: parse-word parse-word dup 0<> IF
        !          7456: $nvalias
        !          7457: ELSE
        !          7458: 2drop 2drop
        !          7459: cr
        !          7460: "    Usage: nvalias (""alias-name< >device-specifier<eol>"" -- )" type
        !          7461: cr
        !          7462: THEN    
        !          7463: ;
        !          7464: : $nvunalias ( name-str name-len -- )
        !          7465: s" " ['] (nv-build-null-entry) (nv-build-nvramrc)
        !          7466: (nvupdate)
        !          7467: ;
        !          7468: : nvunalias ( "alias-name< >" -- )
        !          7469: parse-word $nvunalias
        !          7470: ;
        !          7471: : diagnostic-mode? ( -- diag-switch? ) diag-switch? ;
        !          7472: check-for-nvramrc
        !          7473: 890 cp
        !          7474: defer set-boot-device
        !          7475: defer add-boot-device
        !          7476: : qemu-read-bootlist ( -- )
        !          7477: 0 0 set-boot-device
        !          7478: " boot-device" evaluate swap drop 0 <> IF EXIT THEN   
        !          7479: " qemu,boot-device" get-chosen not IF EXIT THEN
        !          7480: 0 ?DO
        !          7481: dup i + c@ CASE
        !          7482: 0        OF ENDOF
        !          7483: [char] a OF ENDOF
        !          7484: [char] b OF ENDOF
        !          7485: [char] c OF " disk"  add-boot-device ENDOF
        !          7486: [char] d OF " cdrom" add-boot-device ENDOF
        !          7487: [char] n OF " net"   add-boot-device ENDOF
        !          7488: ENDCASE cr
        !          7489: LOOP
        !          7490: drop
        !          7491: ;
        !          7492: ' qemu-read-bootlist to read-bootlist
        !          7493: 8a0 cp
        !          7494: 0 VALUE debug-client-interface?
        !          7495: VOCABULARY client-voc \ We store all client-interface callable words here.
        !          7496: 6789  CONSTANT  sc-exit
        !          7497: 4711  CONSTANT  sc-yield
        !          7498: VARIABLE  client-callback \ Address of client's callback function
        !          7499: : client-data  ciregs >r3 @ ;
        !          7500: : nargs  client-data la1+ l@ ;
        !          7501: : nrets  client-data la1+ la1+ l@ ;
        !          7502: : client-data-to-stack
        !          7503: client-data 3 la+ nargs 0 ?DO dup l@ swap la1+ LOOP drop ;
        !          7504: : stack-to-client-data
        !          7505: client-data nargs nrets + 2 + la+ nrets 0 ?DO tuck l! /l - LOOP drop ;
        !          7506: : call-client ( args len client-entry -- )
        !          7507: >r  ciregs >r7 !  ciregs >r6 !  client-entry-point @ ciregs >r5 !
        !          7508: cistack ciregs >r1 !
        !          7509: r> jump-client drop
        !          7510: BEGIN
        !          7511: client-data-to-stack
        !          7512: client-data l@ zcount
        !          7513: ALSO client-voc $find PREVIOUS
        !          7514: dup 0= >r IF 
        !          7515: CATCH
        !          7516: ?dup IF
        !          7517: dup CASE
        !          7518: sc-exit OF drop r> drop EXIT ENDOF
        !          7519: sc-yield OF drop r> drop EXIT ENDOF
        !          7520: ENDCASE
        !          7521: THROW
        !          7522: THEN
        !          7523: stack-to-client-data
        !          7524: ELSE
        !          7525: cr type ."  NOT FOUND"
        !          7526: THEN
        !          7527: r> ciregs >r3 !  ciregs >r4 @ jump-client 
        !          7528: UNTIL ;
        !          7529: : flip-stack ( a1 ... an n -- an ... a1 )  ?dup IF 1 ?DO i roll LOOP THEN ;
        !          7530: : (callback) ( "service-name<>" "arguments<cr>" -- )
        !          7531: client-callback @  \ client-callback points to the function prolog
        !          7532: dup 8 + @ ciregs >r2 !  \ Set up the TOC pointer (???)
        !          7533: @ call-client ;  \ Resolve the function's address from the prolog
        !          7534: ' (callback) to callback
        !          7535: : (continue-client)
        !          7536: s" "  \ make call-client happy, client won't use the string anyways.
        !          7537: ciregs >r4 @ call-client ;
        !          7538: ' (continue-client) to continue-client
        !          7539: : string-to-buffer ( str len buf len -- len' )
        !          7540: 2dup erase rot min dup >r move r> ;
        !          7541: ALSO client-voc DEFINITIONS
        !          7542: : exit  sc-exit THROW ;
        !          7543: : yield  sc-yield THROW ;
        !          7544: : test ( zstr -- missing? )
        !          7545: zcount
        !          7546: debug-client-interface? IF
        !          7547: ." ci: test " 2dup type cr
        !          7548: THEN
        !          7549: ALSO client-voc $find PREVIOUS IF
        !          7550: drop FALSE
        !          7551: ELSE
        !          7552: 2drop TRUE
        !          7553: THEN 
        !          7554: ;
        !          7555: : finddevice ( zstr -- phandle )
        !          7556: zcount
        !          7557: debug-client-interface? IF
        !          7558: ." ci: finddevice " 2dup type cr
        !          7559: THEN
        !          7560: find-node dup 0= IF drop -1 THEN
        !          7561: ;
        !          7562: : getprop ( phandle zstr buf len -- len' )
        !          7563: >r >r zcount rot get-property
        !          7564: 0= IF r> swap dup r> min swap >r move r>
        !          7565: ELSE r> r> 2drop -1 THEN ;
        !          7566: : getproplen ( phandle zstr -- len )
        !          7567: zcount rot get-property 0= IF nip ELSE -1 THEN ;
        !          7568: : setprop ( phandle zstr buf len -- size|-1 )
        !          7569: dup >r            \ save len
        !          7570: encode-bytes      ( phandle zstr prop-addr prop-len )
        !          7571: 2swap zcount rot  ( prop-addr prop-len name-addr name-len phandle )
        !          7572: current-node @ >r \ save current node
        !          7573: set-node          \ change to specified node
        !          7574: property          \ set property
        !          7575: r> set-node       \ restore original node
        !          7576: r>                \ always return size, because we can not fail.
        !          7577: ;
        !          7578: : canon ( zstr buf len -- len' )
        !          7579: over >r move r> zcount nip ;
        !          7580: : nextprop ( phandle zstr buf -- flag ) \ -1 invalid, 0 end, 1 ok
        !          7581: >r zcount rot next-property IF r> zplace 1 ELSE r> drop 0 THEN ; 
        !          7582: : open ( zstr -- ihandle )
        !          7583: zcount
        !          7584: debug-client-interface? IF
        !          7585: ." ci: open " 2dup type cr
        !          7586: THEN
        !          7587: open-dev
        !          7588: ;
        !          7589: : close ( ihandle -- )
        !          7590: debug-client-interface? IF
        !          7591: ." ci: close " dup . cr
        !          7592: THEN
        !          7593: close-dev
        !          7594: ;
        !          7595: : write ( ihandle str len -- len' )      rot s" write" rot
        !          7596: ['] $call-method CATCH IF 2drop 3drop -1 THEN ;
        !          7597: : read  ( ihandle str len -- len' )      rot s" read"  rot
        !          7598: ['] $call-method CATCH IF 2drop 3drop -1 THEN ;
        !          7599: : seek  ( ihandle hi lo -- status  ) swap rot s" seek" rot
        !          7600: ['] $call-method CATCH IF 2drop 3drop -1 THEN ;
        !          7601: : claim  ( addr len align -- base )
        !          7602: debug-client-interface? IF
        !          7603: ." ci: claim " .s cr
        !          7604: THEN
        !          7605: dup  IF  rot drop
        !          7606: ['] claim CATCH  IF  2drop -1  THEN
        !          7607: ELSE
        !          7608: ['] claim CATCH  IF  3drop -1  THEN
        !          7609: THEN
        !          7610: ;
        !          7611: : release ( addr len -- )
        !          7612: debug-client-interface? IF
        !          7613: ." ci: release " .s cr
        !          7614: THEN
        !          7615: release
        !          7616: ;
        !          7617: : instance-to-package ( ihandle -- phandle )
        !          7618: ihandle>phandle ;
        !          7619: : package-to-path ( phandle buf len -- len' )
        !          7620: 2>r node>path 2r> string-to-buffer ;
        !          7621: : instance-to-path ( ihandle buf len -- len' )
        !          7622: 2>r instance>path 2r> string-to-buffer ;
        !          7623: : instance-to-interposed-path ( ihandle buf len -- len' )
        !          7624: 2>r instance>qpath 2r> string-to-buffer ;
        !          7625: : call-method ( str ihandle arg ... arg -- result return ... return )
        !          7626: nargs flip-stack zcount
        !          7627: debug-client-interface? IF
        !          7628: ." ci: call-method " 2dup type cr
        !          7629: THEN
        !          7630: rot ['] $call-method CATCH
        !          7631: nrets 0= IF drop ELSE \ if called with 0 return args do not return the catch result
        !          7632: dup IF nrets 1 ?DO -444 LOOP THEN
        !          7633: nrets flip-stack 
        !          7634: THEN
        !          7635: ;
        !          7636: : test-method ( phandle str -- missing? )
        !          7637: zcount
        !          7638: debug-client-interface? IF
        !          7639: ." ci: test-method " 2dup type cr
        !          7640: THEN
        !          7641: rot find-method dup IF nip THEN 0=
        !          7642: ;
        !          7643: : milliseconds  milliseconds ;
        !          7644: : start-cpu ( phandle addr r3 -- )
        !          7645: >r >r 
        !          7646: s" reg" rot get-property 0= IF drop l@ 
        !          7647: ELSE true ABORT" start-cpu called with invalid phandle" THEN 
        !          7648: r> r> of-start-cpu drop
        !          7649: ;
        !          7650: : quiesce  ( -- )
        !          7651: debug-client-interface? IF
        !          7652: ." ci: quiesce" cr
        !          7653: THEN
        !          7654: quiesce
        !          7655: ;
        !          7656: : interpret ( ... zstr -- result ... )
        !          7657: zcount
        !          7658: debug-client-interface? IF
        !          7659: ." ci: interpret " 2dup type cr
        !          7660: THEN
        !          7661: ['] evaluate CATCH
        !          7662: ;
        !          7663: : set-callback ( newfunc -- oldfunc )
        !          7664: client-callback @ swap client-callback ! ;
        !          7665: PREVIOUS DEFINITIONS
        !          7666: false value elf-claim?
        !          7667: 0     value last-claim
        !          7668: 0 VALUE cur-brk
        !          7669: : elf-claim-segment ( addr size -- errorcode )
        !          7670: 2dup
        !          7671: elf-claim? IF
        !          7672: >r
        !          7673: here last-claim , to last-claim                \ Setup ptr to last claim
        !          7674: dup , r> dup , ( addr size )
        !          7675: 0 ['] claim CATCH IF
        !          7676: ." Memory for ELF file is already in use!" cr
        !          7677: true ABORT" Memory for ELF file already in use "
        !          7678: THEN
        !          7679: drop
        !          7680: ELSE
        !          7681: 2drop
        !          7682: THEN
        !          7683: + to cur-brk
        !          7684: 0 
        !          7685: ;
        !          7686: : elf-load-claim ( file-addr destaddr -- claim-list entry imagetype )
        !          7687: true to elf-claim?
        !          7688: 0 to last-claim
        !          7689: dup -1 = IF             \ If destaddr == -1 then load to addr from ELF header
        !          7690: drop ['] elf-load-file CATCH IF false to elf-claim? ABORT THEN
        !          7691: ELSE
        !          7692: ['] elf-load-file-to-addr CATCH IF false to elf-claim? ABORT THEN
        !          7693: THEN
        !          7694: >r
        !          7695: last-claim swap
        !          7696: false to elf-claim?
        !          7697: r>
        !          7698: ;
        !          7699: : elf-release ( claim-list -- )
        !          7700: BEGIN
        !          7701: dup cell+                   ( claim-list claim-list-addr )
        !          7702: dup @ swap cell+ @          ( claim-list claim-list-addr claim-list-sz )
        !          7703: release                     ( claim-list )
        !          7704: @ dup 0=                    ( Next-element )
        !          7705: UNTIL
        !          7706: drop
        !          7707: ;
        !          7708: CREATE bootdevice 2 cells allot bootdevice 2 cells erase
        !          7709: CREATE bootargs 2 cells allot bootargs 2 cells erase
        !          7710: CREATE load-list 2 cells allot load-list 2 cells erase
        !          7711: : start-elf ( arg len entry -- )
        !          7712: msr@ 7fffffffffffffff and 2000 or ciregs >srr1 ! call-client
        !          7713: ;
        !          7714: : start-elf64 ( arg len entry -- )
        !          7715: msr@ 2000 or ciregs >srr1 !
        !          7716: dup 8 + @ ciregs >r2 ! @ call-client \ entry point is pointer to .opd
        !          7717: ;
        !          7718: : set-bootpath
        !          7719: s" disk" find-alias
        !          7720: dup IF ELSE drop s" boot-device" evaluate find-alias THEN
        !          7721: dup IF strdup ELSE 0 THEN
        !          7722: encode-string s" bootpath" set-chosen
        !          7723: ;
        !          7724: : set-netbootpath
        !          7725: s" net" find-alias
        !          7726: ?dup IF strdup encode-string s" bootpath" set-chosen THEN
        !          7727: ;
        !          7728: : set-bootargs
        !          7729: skipws 0 parse dup 0= IF
        !          7730: 2drop s" boot-file" evaluate
        !          7731: THEN
        !          7732: encode-string s" bootargs" set-chosen
        !          7733: ;
        !          7734: : .(client-exec) ( arg len -- rc )
        !          7735: s" snk" romfs-lookup 0<> IF
        !          7736: paflof-start f00000 +
        !          7737: elf-load-file-to-addr drop start-elf64 client-data
        !          7738: ELSE
        !          7739: 2drop false
        !          7740: THEN
        !          7741: ;
        !          7742: ' .(client-exec) to (client-exec)
        !          7743: : .client-exec ( arg len -- rc ) set-bootargs (client-exec) ;
        !          7744: ' .client-exec to client-exec
        !          7745: : netflash ( -- rc ) s" netflash 2000000 " (parse-line) $cat set-netbootpath
        !          7746: client-exec
        !          7747: ;
        !          7748: : netsave  ( "addr len {filename}[,params]" -- rc )
        !          7749: (parse-line) dup 0> IF
        !          7750: s" netsave " 2swap $cat set-netbootpath client-exec
        !          7751: ELSE
        !          7752: cr
        !          7753: ." Usage: netsave addr len [bootp|dhcp,]filename[,siaddr][,ciaddr][,giaddr][,bootp-retries][,tftp-retries][,use_ci]"
        !          7754: cr 2drop
        !          7755: THEN
        !          7756: ;
        !          7757: : ping  ( "{device-path:[device-args,]server-ip,[client-ip],[gateway-ip][,timeout]}" -- )
        !          7758: my-self >r current-node @ >r  \ Save my-self
        !          7759: (parse-line) open-dev dup  IF
        !          7760: dup to my-self dup ihandle>phandle set-node
        !          7761: s" ping" rot ['] $call-method CATCH  IF
        !          7762: cr
        !          7763: ." Not a pingable device"
        !          7764: cr 3drop
        !          7765: THEN
        !          7766: ELSE
        !          7767: cr
        !          7768: ." Usage: ping device-path:[device-args,]server-ip,[client-ip],[gateway-ip][,timeout]"
        !          7769: cr drop
        !          7770: THEN
        !          7771: r> set-node r> to my-self  \ Restore my-self
        !          7772: ;
        !          7773: 8a8 cp
        !          7774: : enable-framebuffer-output  ( -- )
        !          7775: s" screen" find-alias ?dup  IF
        !          7776: open-dev close-node
        !          7777: s" display-emit" $find  IF 
        !          7778: to emit 
        !          7779: ELSE
        !          7780: 2drop
        !          7781: THEN
        !          7782: THEN
        !          7783: ;
        !          7784: enable-framebuffer-output
        !          7785: 8b0 cp
        !          7786: usb-scan
        !          7787: 8c0 cp
        !          7788: romfs-base 400000 0 ' claim CATCH IF ." claim failed!" cr 2drop THEN drop
        !          7789: 8d0 cp
        !          7790: : set-default-console
        !          7791: s" linux,stdout-path" get-chosen IF
        !          7792: decode-string
        !          7793: ." Using default console: " 2dup type cr
        !          7794: io
        !          7795: 2drop
        !          7796: ELSE
        !          7797: ." No console specified "
        !          7798: " screen" find-alias dup IF nip THEN
        !          7799: " keyboard" find-alias dup IF nip THEN
        !          7800: AND IF
        !          7801: ." using screen & keyboard" cr
        !          7802: " screen" output
        !          7803: " keyboard" input
        !          7804: ELSE
        !          7805: " hvterm" find-alias IF
        !          7806: drop
        !          7807: ." using hvterm" cr
        !          7808: " hvterm" io
        !          7809: ELSE
        !          7810: ." and no default found" cr
        !          7811: THEN
        !          7812: THEN
        !          7813: THEN
        !          7814: ;
        !          7815: set-default-console
        !          7816: 8e0 cp
        !          7817: 0 VALUE direct-ram-boot-base
        !          7818: 0 VALUE direct-ram-boot-size
        !          7819: CREATE boot-opd 10 ALLOT
        !          7820: : (boot-ram)
        !          7821: direct-ram-boot-size 0<> IF
        !          7822: ." Booting from memory..." cr
        !          7823: direct-ram-boot-base boot-opd !
        !          7824: 0 boot-opd 8 + !
        !          7825: s" boot-opd to go-entry" evaluate
        !          7826: s" true state-valid ! " evaluate
        !          7827: s" disable-watchdog go-64" evaluate
        !          7828: THEN
        !          7829: ;
        !          7830: 8e8 cp
        !          7831: : check-boot-from-ram
        !          7832: s" qemu,boot-kernel" get-chosen IF
        !          7833: decode-int -rot decode-int -rot ( n1 n2 p s )
        !          7834: decode-int -rot decode-int -rot ( n1 n2 n3 n4 p s )
        !          7835: 2drop
        !          7836: swap 20 << or to direct-ram-boot-size
        !          7837: swap 20 << or to direct-ram-boot-base
        !          7838: ." Detected RAM kernel at " direct-ram-boot-base .
        !          7839: ." (" direct-ram-boot-size . ." bytes) "
        !          7840: s" boot-command" $create " (boot-ram)" env-string
        !          7841: THEN
        !          7842: ;
        !          7843: check-boot-from-ram
        !          7844: 8ff cp
        !          7845: : (boot) ( -- )
        !          7846: s" Executing following boot-command: "
        !          7847: boot-command $cat nvramlog-write-string-cr
        !          7848: s" boot-command" evaluate      \ get boot command
        !          7849: ['] evaluate catch ?dup IF     \ and execute it
        !          7850: ." boot attempt returned: "
        !          7851: abort"-str @ count type cr
        !          7852: nip nip                     \ drop string from 1st evaluate
        !          7853: throw
        !          7854: THEN
        !          7855: ;
        !          7856: : (function-key) ( -- n )
        !          7857: key? IF
        !          7858: key CASE
        !          7859: 50  OF 1 ENDOF
        !          7860: 7e  OF 1 ENDOF
        !          7861: dup OF 0 ENDOF
        !          7862: ENDCASE
        !          7863: THEN
        !          7864: ;
        !          7865: : (esc-sequence) ( -- n )
        !          7866: key? IF
        !          7867: key CASE
        !          7868: 4f  OF (function-key) ENDOF
        !          7869: 5b  OF
        !          7870: key key drop (function-key) ENDOF
        !          7871: dup OF 0 ENDOF
        !          7872: ENDCASE
        !          7873: THEN
        !          7874: ;
        !          7875: : (s-pressed) ( -- )
        !          7876: s" An 's' has been pressed. Entering Open Firmware Prompt"
        !          7877: nvramlog-write-string-cr
        !          7878: ;
        !          7879: : (boot?) ( -- )
        !          7880: of-prompt? not auto-boot? and IF
        !          7881: (boot)
        !          7882: THEN
        !          7883: ;
        !          7884: false VALUE (sms-loaded?)
        !          7885: false value (sms-available?)
        !          7886: s" sms.fs" romfs-lookup IF true to (sms-available?) drop THEN
        !          7887: (sms-available?) [IF]
        !          7888: s" /packages" find-device
        !          7889: new-device
        !          7890: s" sms" device-name
        !          7891: : open true ;
        !          7892: : close ;
        !          7893: finish-device
        !          7894: device-end \ leave /packages
        !          7895: : sms-init-nvram ( -- )
        !          7896: nvram-partition-type-sms get-nvram-partition IF
        !          7897: cr ." Could not find SMS partition in NVRAM - "
        !          7898: nvram-partition-type-sms s" SMS" d# 1024 new-nvram-partition
        !          7899: ABORT" Failed to create SMS NVRAM partition"
        !          7900: 2dup erase-nvram-partition drop
        !          7901: 2dup s" lang"                    s" 1" internal-set-env drop
        !          7902: 2dup s" tftp-retries"            s" 5" internal-set-env drop
        !          7903: 2dup s" tftp-blocksize"                s" 512" internal-set-env drop
        !          7904: 2dup s" bootp-retries"         s" 255" internal-set-env drop
        !          7905: 2dup s" client"            s" 000.000.000.000" internal-set-env drop
        !          7906: 2dup s" server"       s" 000.000.000.000" internal-set-env drop
        !          7907: 2dup s" gateway"      s" 000.000.000.000" internal-set-env drop
        !          7908: 2dup s" netmask"      s" 255.255.255.000" internal-set-env drop
        !          7909: 2dup s" net-protocol"            s" 0" internal-set-env drop
        !          7910: 2dup s" net-flags"               s" 0" internal-set-env drop
        !          7911: 2dup s" net-device"              s" 0" internal-set-env drop
        !          7912: 2dup s" net-client-name"                  s" " internal-set-env drop
        !          7913: 2dup s" scsi-spinup"             s" 6" internal-set-env drop
        !          7914: 2dup s" scsi-id-0"               s" 7" internal-set-env drop
        !          7915: 2dup s" scsi-id-1"               s" 7" internal-set-env drop
        !          7916: 2dup s" scsi-id-2"               s" 7" internal-set-env drop
        !          7917: 2dup s" scsi-id-3"               s" 7" internal-set-env drop
        !          7918: ." created" cr
        !          7919: THEN
        !          7920: s" sms-nvram-partition" $2constant
        !          7921: ;
        !          7922: sms-init-nvram
        !          7923: : sms-add-env ( "name" "value" -- ) sms-nvram-partition 2rot 2rot internal-add-env drop ;
        !          7924: : sms-set-env ( "name" "value" -- ) sms-nvram-partition 2rot 2rot internal-set-env drop ;
        !          7925: : sms-get-env ( "name" -- "value" TRUE | FALSE) sms-nvram-partition 2swap internal-get-env ;
        !          7926: : sms-get-net-device ( -- n )  s" net-device" sms-get-env IF $dnumber IF 0 THEN ELSE 0 THEN ;
        !          7927: : sms-set-net-device ( n -- )  (.d) s" net-device" 2swap sms-set-env ;
        !          7928: : sms-get-net-flags ( -- n )   s" net-flags" sms-get-env IF $dnumber IF 0 THEN ELSE 0 THEN ;
        !          7929: : sms-set-net-flags ( n -- )   (.d) s" net-flags" 2swap sms-set-env ;
        !          7930: : sms-get-net-protocol ( -- n )        s" net-protocol" sms-get-env IF $dnumber IF 0 THEN ELSE 0 THEN ;
        !          7931: : sms-set-net-protocol ( n -- )        (.d) s" net-protocol" 2swap sms-set-env ;
        !          7932: : sms-get-lang ( -- n )        s" lang" sms-get-env IF $dnumber IF 1 THEN ELSE 1 THEN ;
        !          7933: : sms-set-lang ( n -- )        (.d) s" lang" 2swap sms-set-env ;
        !          7934: : sms-get-bootp-retries ( -- n ) s" bootp-retries" sms-get-env IF $dnumber IF 255 THEN ELSE 255 THEN ;
        !          7935: : sms-set-bootp-retries ( n -- ) (.d) s" bootp-retries" 2swap sms-set-env ;
        !          7936: : sms-get-tftp-retries ( -- n )        s" tftp-retries" sms-get-env IF $dnumber IF 5 THEN ELSE 5 THEN ;
        !          7937: : sms-set-tftp-retries ( n -- ) (.d) s" tftp-retries" 2swap sms-set-env ;
        !          7938: : sms-get-tftp-blocksize ( -- n ) s" tftp-blocksize" sms-get-env IF $dnumber IF 5 THEN ELSE 5 THEN ;
        !          7939: : sms-set-tftp-blocksize ( n -- ) (.d) s" tftp-blocksize" 2swap sms-set-env ;
        !          7940: : sms-get-client ( -- FALSE | n1 n2 n3 n4 TRUE ) s" client" sms-get-env IF (ipaddr) ELSE false THEN ;
        !          7941: : sms-set-client ( n1 n2 n3 n4 -- ) (ipformat) s" client" 2swap sms-set-env ;
        !          7942: : sms-get-server ( -- FALSE | n1 n2 n3 n4 TRUE ) s" server" sms-get-env IF (ipaddr) ELSE false THEN ;
        !          7943: : sms-set-server ( n1 n2 n3 n4 -- ) (ipformat) s" server" 2swap sms-set-env ;
        !          7944: : sms-get-gateway ( -- FALSE | n1 n2 n3 n4 TRUE ) s" gateway" sms-get-env IF (ipaddr) ELSE false THEN ;
        !          7945: : sms-set-gateway ( n1 n2 n3 n4 -- ) (ipformat) s" gateway" 2swap sms-set-env ;
        !          7946: : sms-get-subnet ( -- FALSE | n1 n2 n3 n4 TRUE ) s" netmask" sms-get-env IF (ipaddr) ELSE false THEN ;
        !          7947: : sms-set-subnet ( n1 n2 n3 n4 -- ) (ipformat) s" netmask" 2swap sms-set-env ;
        !          7948: : sms-get-client-name ( -- FALSE | addr len TRUE ) s" net-client-name" sms-get-env ;
        !          7949: : sms-set-client-name ( addr len -- ) s" net-client-name" 2swap sms-set-env ;
        !          7950: : sms-get-scsi-spinup ( -- n ) s" scsi-spinup" sms-get-env IF $dnumber IF 6 THEN ELSE 6 THEN ;
        !          7951: : sms-set-scsi-spinup ( n -- ) (.d) s" scsi-spinup" 2swap sms-set-env ;
        !          7952: : sms-get-scsi-id ( n -- id )  s" scsi-id-" rot (.) $cat sms-get-env IF $dnumber IF 6 THEN ELSE 6 THEN ;
        !          7953: : sms-set-scsi-id ( id n -- ) swap (.d) rot s" scsi-id-" rot (.) $cat sms-set-env ;
        !          7954: : sms-get-net-boot-file ( -- addr len )
        !          7955: s" net" sms-get-net-device (.) $cat
        !          7956: s" :dhcp," $cat
        !          7957: sms-get-server IF (ipformat) $cat THEN
        !          7958: s" ," $cat
        !          7959: sms-get-client-name IF $cat THEN
        !          7960: s" ," $cat
        !          7961: sms-get-client IF (ipformat) $cat THEN
        !          7962: s" ," $cat
        !          7963: sms-get-gateway IF (ipformat) $cat THEN
        !          7964: s" ," $cat
        !          7965: sms-get-bootp-retries dup ff <> IF (.) $cat ELSE drop THEN
        !          7966: s" ," $cat
        !          7967: sms-get-tftp-retries (.) $cat
        !          7968: dup IF
        !          7969: strdup ( s" :" 2swap $cat strdup )
        !          7970: THEN
        !          7971: ;
        !          7972: ' sms-get-net-boot-file to furnish-boot-file
        !          7973: : $sms-node s" /packages/sms" ;
        !          7974: : (sms-init-package) ( -- true|false )
        !          7975: (sms-loaded?) ?dup IF EXIT THEN
        !          7976: $sms-node ['] find-device catch IF 2drop false EXIT THEN
        !          7977: s" sms.fs" [COMPILE] included
        !          7978: device-end
        !          7979: true dup to (sms-loaded?)
        !          7980: ;
        !          7981: : (sms-evaluate) ( addr len -- )
        !          7982: (sms-init-package) not IF
        !          7983: cr ." SMS is not available." cr 2drop exit
        !          7984: THEN
        !          7985: s" Entering SMS ..." type
        !          7986: disable-watchdog
        !          7987: reset-dual-emit
        !          7988: 2>r $sms-node find-device
        !          7989: 2r> evaluate
        !          7990: device-end
        !          7991: vpd-boot-import
        !          7992: ;
        !          7993: : sms-start ( -- ) s" sms-start" (sms-evaluate) ;
        !          7994: : sms-fru-replacement ( -- ) s" sms-fru-replacement" (sms-evaluate) ;
        !          7995: [ELSE]
        !          7996: : sms-start ( -- ) cr ." SMS is not available." cr ;
        !          7997: : sms-fru-replacement ( -- ) cr ." SMS FRU replacement is not available." cr ;
        !          7998: [THEN]
        !          7999: TRUE VALUE use-load-watchdog?
        !          8000: : start-it ( -- )
        !          8001: key? IF
        !          8002: key CASE
        !          8003: [char] s  OF (s-pressed) ENDOF
        !          8004: 1b        OF
        !          8005: (esc-sequence) CASE
        !          8006: 1   OF console-clean-fifo sms-start (boot) ENDOF
        !          8007: dup OF (boot?) ENDOF
        !          8008: ENDCASE
        !          8009: ENDOF
        !          8010: dup OF (boot?) ENDOF
        !          8011: ENDCASE
        !          8012: ELSE
        !          8013: (boot?)
        !          8014: THEN
        !          8015: disable-watchdog  FALSE to use-load-watchdog?
        !          8016: .banner
        !          8017: ;
        !          8018: ."      "   \ Clear last checkpoint
        !          8019: 0 VALUE load-size
        !          8020: 0 VALUE go-entry
        !          8021: VARIABLE state-valid false state-valid !
        !          8022: CREATE go-args 2 cells allot go-args 2 cells erase
        !          8023: : $bootargs
        !          8024: bootargs 2@ ?dup IF
        !          8025: ELSE s" diagnostic-mode?" evaluate and IF s" diag-file" evaluate
        !          8026: ELSE s" boot-file" evaluate THEN THEN
        !          8027: ;
        !          8028: : $bootdev ( -- device-name len )
        !          8029: bootdevice 2@ dup IF s"  " $cat THEN
        !          8030: s" diagnostic-mode?" evaluate IF
        !          8031: s" diag-device" evaluate
        !          8032: ELSE
        !          8033: s" boot-device" evaluate
        !          8034: THEN
        !          8035: $cat \ prepend bootdevice setting from vpd-bootlist
        !          8036: strdup
        !          8037: ?dup 0= IF
        !          8038: disable-watchdog
        !          8039: drop true ABORT" No boot device!"
        !          8040: THEN
        !          8041: ;
        !          8042: : set-boot-args ( str len -- ) dup IF strdup ELSE nip dup THEN bootargs 2! ;
        !          8043: : (set-boot-device) ( str len -- )
        !          8044: ?dup IF 1+ strdup 1- ELSE drop 0 0 THEN bootdevice 2!
        !          8045: ;
        !          8046: ' (set-boot-device) to set-boot-device
        !          8047: : (add-boot-device) ( str len -- )     \ Concatenate " str" to "bootdevice"
        !          8048: bootdevice 2@ ?dup IF $cat-space ELSE drop THEN set-boot-device
        !          8049: ;
        !          8050: ' (add-boot-device) to add-boot-device
        !          8051: 0 value claim-list
        !          8052: : no-go ( -- ) -64 boot-exception-handler ABORT ;
        !          8053: defer go ( -- )
        !          8054: : go-32 ( -- )
        !          8055: state-valid @ IF
        !          8056: 0 ciregs >r3 ! 0 ciregs >r4 !
        !          8057: go-args 2@ go-entry start-elf client-data
        !          8058: claim-list elf-release 0 to claim-list
        !          8059: THEN
        !          8060: -6d boot-exception-handler ABORT
        !          8061: ;
        !          8062: : go-64 ( -- )
        !          8063: state-valid @ IF
        !          8064: 0 ciregs >r3 ! 0 ciregs >r4 !
        !          8065: go-args 2@ go-entry start-elf64 client-data
        !          8066: claim-list elf-release 0 to claim-list
        !          8067: THEN
        !          8068: -6d boot-exception-handler ABORT
        !          8069: ;
        !          8070: : load-elf-init ( arg len file-addr -- success )
        !          8071: false state-valid !                            \ Not valid anymore ...
        !          8072: claim-list IF                                    \ Release claimed mem
        !          8073: claim-list elf-release 0 to claim-list        \ from last load
        !          8074: THEN
        !          8075: true swap -1                       ( arg len true file-addr -1 )
        !          8076: elf-load-claim                     ( arg len true claim-list entry elftype )
        !          8077: CASE
        !          8078: 1  OF ['] go-32 ENDOF           ( arg len true claim-list entry go )
        !          8079: 2  OF ['] go-64 ENDOF           ( arg len true claim-list entry go )
        !          8080: dup OF ['] no-go to go
        !          8081: 2drop 3drop false EXIT   ENDOF                   ( false )
        !          8082: ENDCASE
        !          8083: to go to go-entry to claim-list
        !          8084: dup state-valid ! -rot
        !          8085: 2 pick IF
        !          8086: go-args 2!
        !          8087: ELSE
        !          8088: 2drop
        !          8089: THEN
        !          8090: ;
        !          8091: : init-program ( -- )
        !          8092: $bootargs LOAD-BASE ['] load-elf-init CATCH ?dup IF
        !          8093: boot-exception-handler
        !          8094: 2drop 2drop false          \ Could not claim
        !          8095: ELSE IF
        !          8096: 0 ciregs 2dup >r3 ! >r4 !  \ Valid (ELF ) Image
        !          8097: THEN
        !          8098: THEN
        !          8099: ;
        !          8100: : do-load ( devstr len -- img-size )   \ Device method wrapper
        !          8101: use-load-watchdog? IF
        !          8102: 4ec set-watchdog
        !          8103: THEN
        !          8104: my-self >r current-node @ >r         \ Save my-self
        !          8105: ." Trying to load: " $bootargs type ."  from: " 2dup type ."  ... "
        !          8106: 2dup open-dev dup IF
        !          8107: dup to my-self
        !          8108: dup ihandle>phandle set-node
        !          8109: -rot                              ( ihandle devstr len )
        !          8110: my-args nip 0= IF
        !          8111: 2dup 1- + c@ [char] : <> IF    \ Add : to device path if missing
        !          8112: 1+ strdup 2dup 1- + [char] : swap c!
        !          8113: THEN
        !          8114: THEN
        !          8115: encode-string s" bootpath" set-chosen
        !          8116: $bootargs encode-string s" bootargs" set-chosen
        !          8117: LOAD-BASE s" load" 3 pick ['] $call-method CATCH IF
        !          8118: -67 boot-exception-handler 3drop drop false
        !          8119: ELSE
        !          8120: dup 0> IF
        !          8121: init-program
        !          8122: ELSE
        !          8123: false state-valid !
        !          8124: drop 0                                     \ Could not load
        !          8125: THEN
        !          8126: THEN
        !          8127: swap close-dev device-end dup to load-size
        !          8128: ELSE -68 boot-exception-handler 3drop false THEN
        !          8129: r> set-node r> to my-self                           \ Restore my-self
        !          8130: ;
        !          8131: : parse-load ( "{devlist}" -- success )        \ Parse-execute boot-device list
        !          8132: cr BEGIN parse-word dup WHILE
        !          8133: ( de-alias ) do-load dup 0< IF drop 0 THEN IF
        !          8134: state-valid @ IF ."   Successfully loaded" cr THEN
        !          8135: true 0d parse strdup load-list 2! EXIT
        !          8136: THEN
        !          8137: REPEAT 2drop 0 0 load-list 2! false
        !          8138: ;
        !          8139: : load ( "{params}<eol>"} -- success ) \ Client interface to load
        !          8140: parse-word 0d parse -leading 2swap ?dup IF
        !          8141: de-alias
        !          8142: set-boot-device
        !          8143: ELSE
        !          8144: drop
        !          8145: THEN
        !          8146: set-boot-args s" parse-load " $bootdev $cat strdup evaluate
        !          8147: ;
        !          8148: : load-next ( -- success )     \ Continue after go failed
        !          8149: load-list 2@ ?dup IF s" parse-load " 2swap $cat strdup evaluate
        !          8150: ELSE drop false THEN
        !          8151: ;
        !          8152: : noload false ;
        !          8153: ' no-go to go
        !          8154: : (go-and-catch)  ( -- )
        !          8155: load-base c@ 5c =  load-base 1+ c@ 20 = AND IF
        !          8156: load-size alloc-mem            ( allocated-addr )
        !          8157: ?dup 0= IF ." alloc-mem failed." cr EXIT THEN
        !          8158: load-size >r >r                ( R: allocate-addr load-size )
        !          8159: load-base r@ load-size move    \ Move away from load-base
        !          8160: r@ load-size evaluate          \ Run the script
        !          8161: r> r> free-mem
        !          8162: EXIT
        !          8163: THEN
        !          8164: ['] go behavior CATCH IF -69 boot-exception-handler THEN
        !          8165: ;
        !          8166: read-bootlist
        !          8167: : boot
        !          8168: load 0= IF -65 boot-exception-handler EXIT THEN
        !          8169: disable-watchdog (go-and-catch)
        !          8170: BEGIN load-next WHILE
        !          8171: disable-watchdog (go-and-catch)
        !          8172: REPEAT
        !          8173: .banner
        !          8174: ;
        !          8175: : load load 0= IF -65 boot-exception-handler THEN ;
        !          8176: : yaboot ." Use 'boot disk' instead " ;
        !          8177: : netboot ( -- rc ) ." Use 'boot net' instead " ;
        !          8178: : netboot-arg ( arg-string -- rc )
        !          8179: s" boot net " 2swap $cat (parse-line) $cat
        !          8180: evaluate
        !          8181: ;
        !          8182: : netload ( -- rc ) (parse-line)
        !          8183: load-base >r FLASH-LOAD-BASE to load-base
        !          8184: s" load net:" strdup 2swap $cat strdup evaluate
        !          8185: r> to load-base
        !          8186: load-size
        !          8187: ;
        !          8188: : neteval ( -- ) FLASH-LOAD-BASE netload evaluate ;
        !          8189: cr .(   Welcome to Open Firmware)
        !          8190: cr
        !          8191: cr .(   Copyright (c) char ) emit .(  2004, 2011 IBM Corporation All rights reserved.)
        !          8192: cr .(   This program and the accompanying materials are made available)
        !          8193: cr .(   under the terms of the BSD License available at)
        !          8194: cr .(   http://www.opensource.org/licenses/bsd-license.php)
        !          8195: cr cr
        !          8196: ' start-it CATCH drop
        !          8197: cr ." Ready!"
        !          8198: &��xP&&���PGCC: (GNU) 4.4.5.symtab.strtab.shstrtab.rela.slof.loader.rela.text.rela.opd.rela.got.rela.data.comment.branch_lt.bss &&&L&�@�&2&��-�0=8=&���8<hG&����&�BMx@Q&�`�`FpLR�&=�      W&0����&&`&����k�������p&&��      �X�&���     �`
�&&����&�00���\��D;�&
 5��C��a���w=,�=������������ ���8�����`&����&@���L&
 �&
��&�hD&#���&3���&8��&@&@�x&�&O��$&W��(&h8�&u�X�&��&��H$&�
 &��p&\&���&���&&�J�&���&�&�9���
        !          8199: ��� 98/�&�F� XKl���`����&�9����(���������l�
0�����
1
        !          8200: ��P� �#�X6���E�8�M�P ^
A o�y�(D��h(�
a��8(���&�<��JT�=`�� &���h&��p&`%
p9
��B�P<I�0�]
��g�t    +���4�������t�
���JT�J��<`�J��`h���� �n!
��P$�� 6J$A=DQ
��T<�^� &�i���q � }=$�
���=��
����� ����@|��x0�����@4��&� �H'��$/���7��&�?�8tS�P�b�H<k9�tJ�|�
����X4���d��XD��H�engineprintfvsprintfio_printhex16the_data_stackget_partitionincrease_nvram_partition_sizevirtio_get_vring_descbootmsg_warningbootmsg_nvupdatep9_clunkmemmovenvram_write_qwordvirtio_vring_sizecall_clientreset_nvramadd_envvirtioblk_shutdownhash_tablethe_client_stackmemcpyelf_forth_claimputsp9_statp9_transactiontolowernvram_read_dwordromfs_lookupvsnprintfvirtio_9p_initp9_reg_transportthe_pocketsstrtoul_slof_textelf_load_filehv_logical_ci_loadelf_load_file_to_addrwriteLogBytep9_readclear_nvram_partitionc_romfs_lookupdelete_nvram_partitionfree_nvram_bufferhv_logical_ci_storeclient_entry_pointwrite_start_OFio_putcharnvram_read_qwordnvram_debugvirtio_9p_loadvirtio_get_vring_usedepapr_ima_sizevirtioblk_readthe_comp_bufferget_nvram_bufferstrncmpvirtio_9p_shutdownvirtioblk_initstrncpynvram_write_bytethe_return_stackp9_attachvirtio_queue_notifynvram_read_wordepapr_magicnvram_read_bytep9_openbootmsg_cp.hv_hascharbootmsg_checklevelelf_load_segments32elf_load_segments64virtio_get_configthe_exception_framethe_heapmemsetnew_nvram_partitionfdt_start.call_client_binary_OF_fsi_startvirtio_reset_devicethe_memelf_get_base_addr32rphv_hascharhv_send_crqGET_WRNG_LVLhv_putcharreset_buffers__virtio_read_config_binary_OF_fsi_endspnvram_write_dwordhv_getcharbootmsg_debugcpdpprint_msgp9_versionset_envstdout_databootmsg_errorthe_tibbootmsg_setlevelromfs_basenvram_write_word.client_entry_pointerase_nvramwriteLogByte_wrappervirtio_get_qsizevirtio_set_statusdel_envstrlentoupperp9_walkget_envelf_get_base_addr64elf_relocate64asm_coutio_printhv_genericvfprintfthe_client_framevirtio_set_guest_featuresvirtio_get_vring_availwipe_nvramnvramlog_printf&W&W&q&q&J&J&&=&*=&:*&>*&&S&,��*     . 96 9H�,�?�?�?(?? ?:?V?z? ~?�?b?j?0�?�?8�?�?@�?�?H?
        !          8201: ?P*?2?XR?Z?`z?~?h�?�?h�?�?p�? ?x *? .?� V? Z?� �?  �?  �?
        !          8202: 
        !          8203: ?
        !          8204: 2?
        !          8205: Z?
        !          8206: �?
        !          8207: �?
        !          8208: �?.? V?�?�?�??2?R?z?~? �? �?�? �?
?
"?�
J?
R?�
z? 
~?
�?�
�?
�? 
�?�
�?
�? &?Z?�?�?�?*?^?�?�?�??J?n?�?�?�??:?^?�?�?�?F?�?�??:?v?�?�? �?? :? �?�? �? .?R? z? �? �?�?~??�?F?�?�?��?"
        !          8209: 6?�V?|a
        !          8210: �?�g
        !          8211: �?�^
        !          8212: �?�
        !          8213: "?@�
        !          8214: R?p_
        !          8215: �?�y
        !          8216: �?��U
        !          8217: �??L�
        !          8218: b?|B
        !          8219: �?�;
        !          8220: �?�M
        !          8221: �?0
        !          8222: B?hn
        !          8223: z?�h
        !          8224: �?�p
        !          8225: �?O
        !          8226: <
        !          8227: N?Z?�^?�l+
        !          8228: �?�?��?��-
        !          8229: �?K
        !          8230: ?,I
        !          8231: B?T#
        !          8232: j?|9
        !          8233: �?�E
        !          8234: �?�4
        !          8235: ?
        !          8236: *?Hv
        !          8237: ^?�R
        !          8238: �?�C
        !          8239: �?�
        !          8240: �? ,>
        !          8241:  B? x&
        !          8242:  �? �4
        !          8243:  �? �,
        !          8244:  �?!(4
        !          8245: !:?!P,
        !          8246: !f?!�4
        !          8247: !�?!�,
        !          8248: !�?!�,
        !          8249: !�?"r
        !          8250: ".?"Df
        !          8251: "b?"x
        !          8252: "�?"�
        !          8253: "�?#0
        !          8254: #HU
        !          8255: #`
        !          8256: #�?$>?$p
        !          8257: $�
        !          8258: $��
        !          8259: $�:
        !          8260: $�?%
        !          8261: %,U
        !          8262: %T|
        !          8263: %�y
        !          8264: %�?%�
        !          8265: &U
        !          8266: &0
        !          8267: &LU
        !          8268: &x
        !          8269: &�?&�
        !          8270: &�U
        !          8271: 'x
        !          8272: 'F?'l0
        !          8273: '�?'�
        !          8274: '�U
        !          8275: (
        !          8276: (0U
        !          8277: (\l
        !          8278: (�?(�2
        !          8279: (�?(�?)"?)B?)V?)~?)�?)�?)�?)�?)�?*&?*>?*R?*v?*�?*�?+?+?+:?+^?+�?+�?+�?+�?,"?,J?,b?,v?,�?,�?,�?,�?-?-B?-j?-�?-�?-�?.
        !          8280: ?.2?.Z?.�?.�?.�?.�?/?/2?/Z?/n?/�
        !          8281: /�?/�
        !          8282: /�?0
        !          8283: 0?0~?0�?0�?0�V
        !          8284: 3�?�3�z
        !          8285: 3�z
        !          8286: 6h8
        !          8287: 78
        !          8288: 708
        !          8289: 7D8
        !          8290: 7�.
        !          8291: 7�$
        !          8292: 8t$
        !          8293: 9T$
        !          8294: 9�8
        !          8295: :8
        !          8296: :(8
        !          8297: :D8
        !          8298: :`8
        !          8299: :|8
        !          8300: :�8
        !          8301: :�8
        !          8302: :�8
        !          8303: :�8
        !          8304: ;8
        !          8305: ;$8
        !          8306: ;@8
        !          8307: ;\8
        !          8308: ;x8
        !          8309: ;�8
        !          8310: ;�8
        !          8311: <�8
        !          8312: <�
        !          8313: <�8
        !          8314: <�8
        !          8315: <�8
        !          8316: <�8
        !          8317: <�8
        !          8318: <�8
        !          8319: <�8
        !          8320: <�8
        !          8321: <�
        !          8322: =8
        !          8323: =�
        !          8324: =8
        !          8325: =8
        !          8326: =(j
        !          8327: =0`
        !          8328: =<j=L`
        !          8329: =Xj=l`
        !          8330: >(}
        !          8331: >@\
        !          8332: ?Q
        !          8333: ?DP
        !          8334: @T}
        !          8335: @pQ
        !          8336: @�~
        !          8337: @�\
        !          8338: @�P
        !          8339: B�
        !          8340: B�U
        !          8341: EB?�ED
        !          8342: 
        !          8343: E�?�E�
        !          8344: 
        !          8345: E�?�H�
        !          8346: H�U
        !          8347: I�    
        !          8348: I�    
        !          8349: I�?�I�y
        !          8350: I�    
        !          8351: I�    
        !          8352: J(N
        !          8353: J:��J>��J^��Jb��J~��J���L�?�L�
        !          8354: Mv
        !          8355: M`�
        !          8356: Mpv
        !          8357: QDR
        !          8358: Qdv
        !          8359: Qx
        !          8360: Q��
        !          8361: Q�<
        !          8362: Q�?�R�H
        !          8363: SF?�SH
        !          8364: 
        !          8365: S�?�S�
        !          8366: Tw
        !          8367: TZ
        !          8368: TXw
        !          8369: Thw
        !          8370: Tx�
        !          8371: T��
        !          8372: T�w
        !          8373: U?�U?&UhR
        !          8374: U�c
        !          8375: U�k
        !          8376: U�?&U�
        !          8377: 
        !          8378: U�
        !          8379: VG
        !          8380: V<{
        !          8381: Vl 
        !          8382: V�L
        !          8383: V�/
        !          8384: V�?&0V�
        !          8385: 
        !          8386: W?&W
        !          8387: 
        !          8388: W2?& W<
        !          8389: 
        !          8390: WL
        !          8391: W\
        !          8392: W�?&W�
        !          8393: 
        !          8394: W�?&(W�
        !          8395: 
        !          8396: Xw
        !          8397: X$Z
        !          8398: X.?�Xf?�X�w
        !          8399: X�w
        !          8400: X��
        !          8401: X��
        !          8402: X�w
        !          8403: X�?&8Y'
        !          8404: Y�v
        !          8405: Y�
        !          8406: Y��
        !          8407: Y�<
        !          8408: Z�H
        !          8409: [�?&@[�?&@[�U
        !          8410: [�U
        !          8411: [�?&H\J?&@\N?&H]�U
        !          8412: ]�D
        !          8413: ]�?&P]�
        !          8414: 
        !          8415: ^<b
        !          8416: ^F?&H^�!
        !          8417: ^�?&@_�b
        !          8418: _�?&H`�!
        !          8419: `�?&@aH
        !          8420: a�b
        !          8421: a�?&Hb!
        !          8422: b?&@b�b
        !          8423: b�?&Hc�?&Xc�A
        !          8424: d?&@dx
        !          8425: d�?&@d�!
        !          8426: f0y
        !          8427: fF?&@fxb
        !          8428: f~?&Hf�!
        !          8429: g,y
        !          8430: g<y
        !          8431: g�b
        !          8432: g�?&Hhy
        !          8433: h4y
        !          8434: hH
        !          8435: hXy
        !          8436: hpy
        !          8437: h�y
        !          8438: h�
        !          8439: h�y
        !          8440: i!
        !          8441: i@b
        !          8442: iF?&HiJ?&`i�y
        !          8443: i�y
        !          8444: i�
        !          8445: jy
        !          8446: j!
        !          8447: jR?&@j�?&hj�A
        !          8448: j�?&pk?&pk>?&pkj?&pk�?&pk�?&pk�?&pl
        !          8449: ?&plB?&plr?&pl�?&pm�?&pm�?&pn�?&po2?&po�
        !          8450: (o�
        !          8451: (p?&pp$y
        !          8452: pr?&pp�?&pp�?&pq?&pq2?&pq�
        !          8453: (q�?&xq�
        !          8454: �rf?&psPA
        !          8455: tl
        !          8456: t�?&pu2?&puR?&puX
        !          8457: �u�?&pwR?&pw^?&pw�?&pw�
        !          8458: xB?&pxP
        !          8459: �x�
        !          8460: y?&py0
        !          8461: �yL
        !          8462: �y�
        !          8463: z
        !          8464: zv?&pz�?&�z�
        !          8465: �z�?&�z�
        !          8466: �{v?&�{x�
        !          8467: {~?&�{�
        !          8468: �{�
        !          8469: �|K
        !          8470: |HK
        !          8471: |�?&�}K
        !          8472: }PK
        !          8473: }ty
        !          8474: }�A
        !          8475: ~�
        !          8476: x~�y
        !          8477: ~�y
        !          8478: E
        !          8479: ,y
        !          8480: TE
        !          8481: pE
        !          8482: |y
        !          8483: �?&��U
        !          8484: �(K
        !          8485: �dK
        !          8486: ��y
        !          8487: ��A
        !          8488: ��|
        !          8489: ��y
        !          8490: ��A
        !          8491: ��
        !          8492: x�
        !          8493: �� @
        !          8494: �PK
        !          8495: �xK
        !          8496: ��E
        !          8497: ��y
        !          8498: ��E
        !          8499: �E
        !          8500: �43
        !          8501: �`E
        !          8502: ��
        !          8503: �D
        !          8504: x�X
        !          8505: ��xK
        !          8506: ��@
        !          8507: ��K
        !          8508: �E
        !          8509: �43
        !          8510: �Dt
        !          8511: ��%
        !          8512: �"?&��H�
        !          8513: ��?&���y
        !          8514: ��6
        !          8515: ��?&���6
        !          8516: �0%
        !          8517: �H6
        !          8518: ��?&���?&��`
        !          8519: (�)
        !          8520: �R?&��$)
        !          8521: �4y
        !          8522: ��y
        !          8523: ��
        !          8524: @�$
        !          8525: (�P
        !          8526: @�v?&���
        !          8527: @��
        !          8528: (��?&���
        !          8529: @�
        !          8530: (�V?&���
        !          8531: @��
        !          8532: (��s&��3��X&��3�&&�3�&&P� 3�0&&��83�H&&4P�P3�`&&4��h3�x&&5���3��&&;���3��&&<p��3��&&=���3�&&? �3� &&?��(3�8&&Ap�@3�P&&A��X3�h&&E��p3��&&Gp��3��&&I0��3��&&Ip��3��&&J��3��&&J���3��&&K@�3�&&K��3�(&&K��03�@&&L@�H3�X&&L��`3�p&&L��x3��&&N ��3��&&N���3��&&Q���3��&&R@��3��&&R���3�&&V�3�&&V`� 3�0&&WP�83�H&&Y��P3�`&&Y��h3�x&&Z0��3��&&\ ��3��&&]`��3��&&_`��3��&&`���3��&&d`��3�&&e�3� &&g �(3�8&&h��@3�P&&i�X3�h&&i0�p3��&&i`��3��&&i���3��&&i���3��&&i���3��&&j��3��&&j �3�&&jp�3�(&&j��03�@&&k`�H3�X&&k��`3�p&&l0�x3��&&l���3��&&m`��3��&&mp��3��&&o���3��&&p��3�&&r�3�&&t�� 3�0&&v��83�H&&w��P3�`&&x@�h3�x&&y���3��&&z���3��&&|���3��&&}���3��&&��3��&&����3�&&���3� &&���(3�8&&���@3�P&&� �X3�h&&�`�p3��&&����3��&&�`��3��&&����3��&&����3��&&���3��&&�p�3�&&��3�(&&���03�@&&���H3�X&&���`3�p&&�`�x3��&��&0��i&��
&����������]&��&&���o&��(&��S&���&��&���?&��7&��&����W&�q&�J&�=&�
&� F&�(&�0&�8&�@&�H&&C��P& �X&P�h&h�p&���x&���&��(��&���&���&���&&��&&��&&0��&&H��&0��&��0��e&��&&`��&&p��&&x��&&���&��X�&&��&&�� &&��(&��p�0m&�8m&�@&&��H&&��P&���X&&�h��&���&&���&���&����&&���& ��&h�&&��&8�&�� &��(& P�0&x�8& p�@& ��H& ��P& ��X&��`& ��h& ��p&��x&
        !          8533: ��&
        !          8534: ���&H��& ��&8��&`��&x��&���&���&���&���&���&����&�&x�&��&�� &��0&8�8&`�@&��H&��X&&��h&
���&&���&���&&��&
���&&���&        ���&& ���&
���&& T��&�&&8�&�(&&��0&��@&&
        !          8535: P�H&�X&&
        !          8536: 0�`&0�p&&��x&P��&&���&p��&&���&`��&x��&���&���&���&        ��&�&�&x� &��(&��0&��@& ��H&0�P&H�X&��`&�p&x�x&���&���&���&���&��&H��&���&���&��&���&(��& ��&8�&&��&8�&`�&�� &��(&X�0&p�8&��H&0�P&`�X&��`&��p&`�x& ���&���&
        !          8537: ��&x��&`��&���&��& ��&`��&&���&8��&8��&        ��&`�&x�&�� &��(&�0&��@&��H&�X&x�`&�p&
8�x& ��&���&&���&(��& ���&@��& p��&��&@��& P��&@��& ���&��&@��&8�&�&@�&@�& � &���0&&�@&H�P&&��X&(�`&��h&x�p&@�x&��&���& ���& ��& `��&&0��& ���&&���&��&&��&��&&��&��(&&0�8&��H&& ��P&��`&&��h&X�p&@�x&���&��&@��&
���&���& ���&��&(��&���& ���&(��&���&8��& ��& �&&��&(�&(�&8� & ��(&(�0& ��8& ��@&(�H&��P& P�X&(�`& p�h& ��p&(�x&���& ���&@��& ��& ���&&���&0��&���&���&��&`��&(��&���& ���&(�&��&@�&p�&�� &(�(& �0&x�@&&��H& �P&��p&&���&(��&&���&
��&&���&x��&���&@��&`��&���&���&��&�&��&
8� &(�(&
��0&(�8&�@&�P&0�X&h�`& �h&�x&&���&x��&&���&���&���& ��&���&&���&h��&& ���&��&&X�&�� &&x�(&`�8&&x�@&��X&& ,�`&�p&&�x&
���&&
        !          8538: ��&(��&&T��&����&&-l��&���&&���&x�&��&��&��(&        ��0&`�8&H�@&��H&(�P&��X&
��`&x�h&��x&���&���&���&
���&���& ��&���&&���&���&0��& ��&���&&t��&�&&��&X� &��0&@�8&@�@&x�H&(�P&(�X& �`&
        !          8539: ��x&��&��&&���&x��&x��&���&���& ��&��&&���&���&��&�&��&0� &H�0& �8&��P&&��`&P�p&&
��x& ��&&���&h��&&���&`��&h��&���&���&���&���&���&��& �&��&&��&�� &p�(& �0&(�H&&��P&��X&��`&        ��h&��p&�x& p��& ���&8��&���& P��& ��&���&&��&���&&���& ��&���&`��& ��& h�&&��& P�&�� &��0& ��8& x�@&8�H&8�P& ��X&��`&
��h& P�p&��x&���&���&h��&
���&���&H��& ��&���&&���&`��& ���&��&��&!`�&!`�&� &
��(&`�0&!��8&��H&��P&��`&H�h&@�p&
8�x&(��& ��& ���&&���&#P��&&���&#`��&���&$H��& ��&%��&&��&H� &&��(&`�0& ��8&��H&%��P&��`&!`�h&!`�p&�x&
���&%���&
8��&
���&`��&!���&���&���&���&H��& ���&���&%���&%���&
8�& �&%��&&�� &&h�(& ��0&�8&%��@&&��H&�P&���X&&��`& ��h&%��p& �x&0��&&
        !          8540: ���&���&&
        !          8541: x��&&���&&���&'0��& ��&h��&&���&'`��& ��&'��&&��&'��(&&��8&'��P&&��`&�x&&���&(��&&���&x��&���&x��& ��&H��&&H��&(���&&���&���&
��&)@�&)p�&)�� &(��(& �0&)��@&&��H&)��P&�X&)��`&��p&)��x&*��& ��&*H��&&��&*h��&&���&
���&
���& ��&��&&
        !          8542: ���&*��&&��&�� & �(&*��@&&��H&x�P&H�X& �`&*��x&&D��&
(��&&���&���&���&���& ��&���&&��&+X��&&���&+���&(�&+��&(�& �&��(&&��8&H�H&&$�P&+��h&&,�p&+���&&���&,��&&(��&,8��&H��&&��&x�&&��&*X� &0�(&@�0&0�8& �@&��P&&�`&,`�x&&���&8��&���&X��& ��&p��&&0��&,���&&���&X��&x��&��&��&��&
��&8� &��0&X�8&�@&
��H&-�P&(�X&p�`&H�p& �x&P��&&���&8��&���&`��&H��& ��&'P��&&���&-8��& ��&        ��&&H�&-X�&&�� &
��(&��0&��8& �@&-��P&&��X&-��h&&��p&(�x&���&���&@��& ��&���&&8��&.��&&
���&.��&&���&.P��&@�& ��&.0�&x�&�� &)@�(&��0&��8&/�@&��H&x�P&��X&)@�`&��h&��p&x�x&���&���&���&���&)���&/��&(��& ��& ���&&���&`��& ���&���&���&!`�&!`�&��&� &h�(& �0&/ �@&&�P&/H�h&&��p&��x&���&���& ���&���&H��&���& ��&/p��&&���&h��&���& ���& �&&`�&�� &&��(&/��8&&��@&/��H&0 �P&/��X& �`&0`�p&&��x&/���&x��&@��&0���&8��&1��&(��&1`��&0p��& ��& ���&&���&���& ���& ���& �& 8�&&��& �� & p�(&�0& �8&1��P&&��X&1��`&x�h&��x&���&x��&2���&���&���&���& ��& ��&&���&���&���& ��&2���&&��&x�&��&�� &��(&��0&��8&
��@&@�H&x�P&@�X&��`&��p&��x&x��&���&(��&x��&(��&-��&x��&���&���&���&���&���&���&
���&@�&@�&8�&8�&(� &(�(&3�0&!`�8&��@&��P&��X&��`&��p&4P�x&h€&
�ˆ&�&�˜&� &�¨& °&$8��&&���& ���& ���&��&x��&8��&��&4��&��&
��&8� &�(&��0&��8&��@&4��H&��X&4��`&8�h&*�p&À&�È&�Ð& Ø&4�è&&�ð&@ø& ���&8��&��&���& ���&��&8��&��&
��&`�&(�&5�&��(&!`�0&x�8&4��@&��H&�X&x�`&8�h&*�p& �x&6Ĉ&&�Đ&8Ę&Ġ&-Ĩ&8İ& �ĸ&@��&$H��&
8��& ��&6X��&&���&6p�&6��&6��& �&&X�0&&��8&6��@& �H&7�X&&��`&&h�h& ��p&+��x&%�ŀ&&�ň&Ő&��Ř&&�Š& �Ũ&%�Ű& Ÿ&7X��&&���&���&��&���&
���&��&H�& �&7��(&&��8&7��P&&��X&7��h&&��p&8(�x& ƀ&8HƐ&&�Ƙ&8�Ơ&�ƨ& ư&8���&&���&8���&���& ��&8���&&��&8�&&��&�� &H�(& �0&9�@&&��H&��X&9`�`& �h&�ǀ&&�Lj&(ǐ&�ǘ&xǠ&xǨ&�ǰ&�Ǹ&���&6���&@��& ��&9h��&&���&`�&)��&x�&��&)p� &��(&��8&x�@&��H&�P&)��X&x�`&4��h&)p�p&9�Ȁ&�Ȉ& Ȑ&9�Ƞ&&�Ȩ&4�Ȱ&�ȸ& ��&: ��&&���&:`��& ��&!���&&��&���&��&��&��� & �(&:��8&&��H&��X&&l�`&:��p&&��x&*xɀ&Ɉ&�ɐ&�ɘ& �ɠ& ɨ&:�ɸ&&��& ��&&���&���&
���& ��&;�&&0�&; � &2��0&&��8&��@&2��H& �P&;��`&&��h&��p&�x&�ʀ&�ʈ&
pʐ&�ʘ&ʠ&<(ʨ& �ʰ& ʸ&P��&&���&<X��&(��&<X��&(��&<X��&(�& �&<H�&&�(&9��@&&��H&<h�X&&��`&<��x&&�ˀ&<�ː&&-0˘&��&@��&&���&���&���&X��& �&<��&&��&=(� &�(&��0&=H�8&p�@&=(�H& ��P& �X&)0�h&&��p&4��x&
�̀& ̈&' ̘&&�̠&=�̨&�̰& ̸&=���&&���&)@��&���&6���& ��&��&&��&=�� &&��(&8��0&-�8&��@&8��H&4P�P&6��X& �`&6��p&&
��x&>͠&>HͰ&&�͸&>���&>`��&��&���&>���&���&>`��&�&4��&��&x�&��(&��0&��@&��H&8�P&>`�X& ��`& �h&�x&&�΀&>�ΐ&&�Θ&>�Π& Ψ&�θ&&���&���& ��&*��&&��&0��&&��&��&>��&x�&� &*x�(&
��0& �8&?�H&&��P&>��X&x�`& ��h& �p&?xπ&&�ψ&?�ϐ&xϘ&�Ϩ&ϸ& ��&0���&&���&
8��&>���&x��&��&*x�&
��& �&4@� &&��(&x�0&�8&��H&4P�P& �X&?��h&&��p&?��x&`Ѐ&.Ј&�И&Ш& а&@��&&���&��&���&���&@(��& �&@�&&�� &*��(&x�0&@�8&;�@&@��H&��X&`�`&��h&�p&��x&р&
ш&0ѐ&�Ѡ&!`Ѩ&!`Ѱ&(Ѹ&���&
���&(��&:0��&��&(��&0��&8�& �&��&&�� &x�(&x�0&��8&)@�@&'�H&-��P& �X&@��p&&��x&xҀ&�҈&�Ҙ&
�Ҡ&
�Ҩ&�Ұ&=(Ҹ&��&@���&���&���&@��&���&@��&@�&=(�&�&:�&�� &=(�(&�0&A��8&B0�@&��H&(�P&8�X&Bp�`&(�h&x�p&(�x&-Ӏ&Ӑ&�Ә& Ӡ&B�Ӱ&&�Ӹ&8��&���&
���& ��&X��&&���&���&+��& �&C�&&�� &4��(&��0& �8&(�H&&�X&C8�p&&��x&�Ԁ&8Ԉ&�Ԙ&
�Ԡ&Ԩ&�԰&�Ը&
���&x��&���&���&���&4���&�&��&��&� &:��(&!`�0&!`�8&��@&
��H&H�X&��`&��h&h�p& �x&C�Ո&&�Ր&�ՠ&$Hը&
8հ& ո&X��&&��&C���&&
\��&C��&&��&8�&D8� & �(&)��8&&��@&���H& ��P&8��X&)��`& �h&DX�x&&�ր&&hֈ& �֐&9�֘&%�֠&D�֨&E�ְ& ָ&���&&���&���&���& ���& ��&F�&&��&&h�&FX� &F��(& �0&F��H&&��P&)`�`&&��h&8��p& �x&8x׈&&�א&:`ט&�נ& ר&F�׸&&���&G(��&���& ��&G��&&���&8���&>��& �&GH�&&�� &G��(&��0& �8&Gx�H&&�X&G��h&&��x&9P؈&&�ؐ&�ؠ&9`ب& ذ&H��&&|��&H���&&���&����&8���&-��&6��&��&8�&H�� &�0& �8&8�P&&��X&I�h&&��p&>��x& ـ&I`ِ&&�٘&8�٠&
�٨& ٰ&I���&&���&=���&>���& ��&I���&&-���&I��&&��&(�&(� &(�(&
8�0&@�8& �@&J@�P&&�`&<�x&&�ڀ&X�&
X�&&��&9x� &���(&<(�0&�8&6��@&��H& ��P&8�X&H��`&��h&9x�p& �x&J`ۈ&&�ې&Jxۘ&�۠& ۨ&4�۸&&��&J���&&D��&J��&&��&J��&&-� &J��0&&��8&=(�@&�H&��P&K��X&p�`&=(�h& ��p& �x&�܈&&�ܘ&Kpܨ&&�ܰ&K�ܸ&=(��& ���& ��&K���&&��&K��&&��&<X�&
��& � &L �0&&��8&L��@&L��H&��P&L��X&M�`& �h&��x&&�݀&MP݈& �ݐ&ݘ&%�ݠ& ݨ&H��&&���&���&&���&
��&&��&M��&&�� &��(&`�0& �8&N�H&&��P&���X&��h&��p& �x&NPވ&&�ސ&xޘ&@ޠ&N�ި&(ް&�޸&@��&O ��&(��& ��& ��&&���&=(��&�&N��&��&Nh�&@(� & �(&1P�8&&��@&=(�H&�P&?(�X&B0�`&Nh�h&@(�p& �x&/�߈&&�ߐ&>�ߘ&xߠ&ߨ&-߰&*x߸&���& ���&)���& ��&Ox��&&���& ��&��& �&O��&&�� &
��(&O��0&x�8&��H&��X&Ph�`&��p&���&
���&���&
��&x�&B0�&8�&���&P���&���&!`��&���&��&��&h�& �&Q(� &&��(&8�0&Q��8&��H&8�P&-��X&Q8�`&H�p&��x& �&Q��&&��&@�&��&(�&��& ��&R��&&���&@��&R ��&(��&���& �&R��&&��&@� &S�(&��0&��@&S0�H&.�P&(�X&SH�`& �h&4x�x&&��&��& �& �&%x�&&��&<(��&��&���&x��&���&6p��&.��&���&)��& �&Sh�&&�� &`�(&��0&��8& �@&T(�P&&
(�X&T@�h&&��p&8�x&4��& �&4��&&��&��&��& �&Tp��&&���&&h��& ���&H��&%���&D���&E��& �&&�� &&��(&&��0&�8&0�@&��P&x�X&�`&��h&���p&
��x&
��&��& ��&�&���&
��&%��&&���& ���& ��&T���&&���&���&���&*�&��&�&�� &
��(&U��0&
��8&U��@&�H&��P&���X&V �`&�h& �p&V(�&&��&&h�&V��&��& �&V��&&���&&h��& ���&��&%���&W��&E���& ��&Vx�&&��&&h�&W`� &E��(& �0&W��@&&��H&W��X&&��`&X�h&��p& �x&W��&&��&G��&>��& �&X(�&&���&Xh��&���& ��&XX��&&��&O��&&��&x�&��(&��8&Ph�@&��P&��`&��h& �p&Xx�&&��&��&��&�&Y�&Y ��&��&YX��&G���&9���& ��&Y`�&&��&���&YX�&G�� &)��(& �0&6��@&&��H&���P&)��X&=��`&)��h& �p&Y��&&��&`�&4��&��&��&��& ��&p��&&���&=���&
���& ��&8��&&�&Y��(&&.�0&��@&&��H&(�P&(�X&(�`&��h&��p&@�x&��&@�&��&@�& �&��&&��&0��&&0��&X��&Z�&&��&Z0� &&��(&ZP�8&&,��@&Zh�P&&��X&��`&��h&B0�p&`�x&+��&��&
��&
��&(�&�&���&���& ��&=��&&���&K���&=(�& ��& �&Z�� &&�0&[�@&&�P&,��`&&��h&<X�p&��x& �&[@�&&��&[��&@�&[��&(�&M��& ��&[���&&���&x��&[0��&6��&��&\8�&T8�& � &Y�0&&��8&\`�@&��H&\��P&��X&[��`& �h&\��x&&��&\8�&S0�&.�& �&]�&&��&&h��&���&$H��& ���&( ��&%���&x��&H��&��&��&� &��(&H��0&H�@&9x�H& �P&]`�`&&��h&C��p& �x&=8�&&��&[�&=(��& ���& ��&>���&&���&x��&���&4���&��&��&��&��(&��0& �8&]��H&&��P&8�X&��`&O �h& �p&^P�&&��&��&8�&-��&^`�&H��&���&���& ��&_��&&���&C��&��& �&h�&&�� &�(&p�0& �8&_8�H&&��P&x�X&��h&��x&Ph�&��&��&
��& �&P���&&���&4���&���&P���& ��&@x�&&��&B0�&x�&B0� &TP�(&��8&
8�@&h�H&
��P&4��X&��h&h�p&
��x&���& ��&_��&&��&@�&x�&�&@��&_���&(��&���&���&R ��&(��& �&B �&&��&�� &@�(&��0&(�8& �@&!P�P&&��X&8�`&p�h& �p&`(�&&��&��&@�&x�&@�&��&x�&(��& ��&(��&���&
���& ��&_���&&��&@�&S�&��&��(&S0�0&.�8&(�@&S�H& �P&`p�`&&��h&4��p&T8�x& �&>��&&��&R��&&��&4��&C���& ��&.@��&&���&.P��&@��&$H��&x�&��&)��&��&(� &x�(&\��0&��@&x�H&�P&��X&
��`&)��h&H�x&��& �&S �&&��&D(�&&��&+���&���& ��&`���&&���&U��&&���&�& ��&��&%��&��� &���(&&��0& ��8&8�@&%��H& �P&U��`&&��h&��p&�x&4��&��&*��&���&
���&����&U���& ���&V ��&���&����&U���&&���& ��&a�&&��&(�&�� &x�(&�0&%��8&@�@& �H&U��X&&��h&aP��&&(��&FH��&&���&&h��& ���&���&%���&W��&E���& ��&ap��&&���&U��& ��&��&%��&���&8� &%��(& �0&W�@&&��H&U�P&���X& �`&a��x&&���&����&���&
���&%���& ��&Ep��&&���&����&
���&���&
���&���& ���& �&b�&&�(&8�8&&��@&b0�H&��P& �X&b �h&&��p&Xh�x&>���& ��&-(��&&���&b`��&���& ��&bP��&&��&bp��&&���&��&��&�&Y� &[P�(&�0&YX�8&G��@&9��P& �X&b��h&&8�p&M��&&���&L���&���&M��& ��&X���&&\��&c��&&���&����&c��&Xh��&)���& �&0��&&��&`� &+��(&��8&��@&��H& �P&cH�h&&-��p&c`��&&���&c���&&x��&c���&&.|��&c���&&���&���& ��&B0��&`�&+��&��&
�� &
��(&(�0&�@&��H&��P& �X&c��h&&�x&d��&&��&d0��&&���&d���&���&\���&���&d@��& ��&d���&&��&e�&@�&e�&(� &d��(& �0&e8�H&&��P&x�X&d �`&6��h&��p&K��x&T8��& ��&K���&&��&Lh��&&���&[���&@��&eP��&(��&eP��& ��&Q��&&��&@�&Q�� &(�(&Q��0& �8&e��H&&��P&[��X&��`&d��h& �p&e���&&���&&h��& ���& ��&%���&+��&���& ��&f ��&&���&T8��& ��&fH��&&��&x�&@�&`�&`� &�(&@�0&fX�8&
��@&6��H&(�P&6��X&��h&-�p&��x&(��&���&���&
���&(��&���& ��&g��&&���&@��&x��&��&@��&_���&(��&
��&��&@��&.�&��(&@�0&4��8&.�@&(�H&��P&
��X&(�`& �h&g��x&&���&8��&TP��& ��&8��&&���&x��&@��&)@��&���&x��&���&)���&/��&(��& �&B`�&&��&g�� &Bp�(& �0&PP�@&&��H&`��P&
��X&�`&
��h&@�p&`��x&(��& ��&g���&&���&x��&��&���&g���& ��&h(��&&���&4���&S0��& &D�&&�&U &&�(&0&��8& �@&-�H&%�P&8X&&�`& �h& p&h@�&&��&��&$H�&��& �&h��&&�&WH�&&��&U�& ��&&&%�&&��&&8&&%�& & &(&h�&8&&�&@&&h&H&@&P&i�&X&(&`& &h&i�&x&&�&�&:P&�&&�&�&b`&�&>�&�& &�&=p&�&&&�&i�&�&&�&�&�&�&�&&Y&=� &(&YX0&G�8&9�H& P&jp`&&h&H�x&&��&���&j��&b`�&)��& �&j��&&-��&YH�&&��&V�&&P&j�&&.�&k(&&�0&�8&�@&`H& P&+�`&&p&k(�&&�&L��&&��&d��&@�&d��&(�&M�& �&\H�&&��&L�&@&[�&(&[� & (&e8&&�@&K�H&S0P&.X& `&kHp&&�x&[�&S0�&.�& �&k��&&��&x�&k8�&6��&��&[�&T8�& �&[�&&�&eP&�&e & (&k�@&&�H&9xP&��X& �`&&�h&%�p&7hx& �&S8�&&��&S0�& �&O�&&��&
��&@�&@�&`8�&��&0��&O �&(&&�&4P &((&0&�@&4PH&�P&4PX&�`& h&A�x&&��&`�&`�&@�&@�&0��&(�&0��&A��&(�&�&��&g��& �&6�&&�&8&4�&  &l8&&�@&>�H&@P&4PX&x`&�h&(p&�x&
��& �&lH�&&��&l��&&��&��&�&��&m�& ��&��&%��&
�&�&$H&� & (&m�8&&�@&m�P&&�X&&h`&)@h&@p& �x&
��&%��& ��&��&%��&V��& ��&��&%��&(�& �&F��&&��&&h�& ��& &%� &�� &8 &%�  &� (&W` 0&  8&/ H&&� P&np h&&� p&� x&� �& �&j� �&L� �& �&c �&Xh �&9� �&  �&j� �&&� �&n� �&&�
        !          8543: &��
        !          8544:  &&�
        !          8545: (&��
        !          8546: 0&
        !          8547: 8& 
        !          8548: @&o
        !          8549: X&&,�
        !          8550: `&`
        !          8551: p&&�
        !          8552: x&p
        !          8553: �& 
        !          8554: �&\(
        !          8555: �&&
        !          8556: �&dx
        !          8557: �&&�
        !          8558: �&L�
        !          8559: �&@
        !          8560: �&\`
        !          8561: �&(
        !          8562: �&\`
        !          8563: �& 
        !          8564: �&o(&&�&o8&!` & (&%�8&&�@&`H&;�P&        �X&&�`&%�h&7hp& x&��&&��&x�&�& �&oh�&&��&(�&(�&��&
��&@�&B0�&@�&�& &m&&� &m(&`0&�8&8@&�H&)�P&�X& `&M@p&&�x&��&�&��&MP�& ��&H�&%��&
��&��&$H�&x�&@�&.P�&x�&@
&�
&/
&(
&(
 & 
(&>p
8&&�
@&o�
X&&�
`&&h
h& �
p&�
x&%�
�&0
�&�
�&-
�&�
�&F�
�&
�&E�
�& 
�&o�
�&&�
�&�
�&�&&j�&\� &(&c0&Xh8&9�H& P&)�`&&�h&ph�&&,��&p��&&��&@�&g�&(�&]��& �&p��&&��&(�&(�&(�&B0&@&�& &ip(&&�0&U8&8@& H&q`&&�h&�p&��&�&o�&e��&�&j��&b`�&9��& �&qX�&&,0�&qx�&&�&q�&�& &q�(&&�0&(8&B0@&@H&�P&@X&@`& h&r�x&&��&x�&@�& ��&(�&��& ��& �&s�&&,X�&q��&&��&q��&!`& &N�&&� &@(&l(0&(8&]�@& H&sX&&�`&xh&0p&��&@�&B0�&(�&��&@�&4��&
��&�&0�&��&(�&��&4��&
�&& &s�(&&�0&x8&�@&H&�P&X& `&t@p&&+�x&tX�&&��&x�&0�&��&B0�&@�&4��&
��&�&0�&��&(&Q�&4�&
�&(& 0&t�@&&�H&oP&xX&�h&TPp&��&��&
��& �&t��&&,�&\��&&��&@�&@�&\��&(�&(�&\�& &`&&� &�(&�0& �8& @&t�P&&+�X&uh&&+�p&u(�&&+@�&u@�&&+h�&uX�&&*��&up�&&+�&u��&&*��&u��&&*�&u�&&*H&u�(&&*t0&u�@&&* H&vX&&)�`&vp&&)�x&v0�&&)��&vH�&&($�&v`�&&)��&vx�&&'��&v��&&'��&v�&&'�&v�&&'| &v�0&&'T8&v�H&&' P&w`&&&�h&w x&&(��&w8�&&(��&wP�&&(t�&wp�&&(P�&w��&&)8�&w�&&)&w�(&&)\0&w�H&&&�P&xp&&%�x&x@�&&$��&xh�&&#��&x��&&"��&x�&&&�&x�8&&%D@&yh&&"<p&y8�&&!��&yh�&& ��&y��&& ��&y�&&"�&y�(&&"�0&y�P&&"�X&zp&& `x&z8�&&h�&zX�&& ,�&zx�&&@�&z��&&��&z�&&&z�0&&�8&z�P&&�X&{ x&&��&{@�&&L�&{h�&&��&{��&&4�&{�&&�&{�8&&x@&|X&&@`&|(�&&��&|H�&&��&|h�&&��&|��&&`�&|�&&@&|�0&&�8&}X&&�`&}(�&&��&}P�&&\�&}x�&&(�&}��&&&}�&&�&}�(&&80&}�@&&�H&~X&&�`&~p&&�x&~0�&&��&~H�&&d�&~`�&&��&~��&&�&~��&&P&~�&&  &~�8&&�@&X&&�`& x&&��&@�&&T�&��&&��&`�&=(�&�&@�&N(�&��&(�&=(�& �& &�&&� &`(&=(0&8&@@&=HH&�P&(X&=(`& �h& p&�x�&&��&`�&=(�&�&@�&K��&��&(�&=(�& ��& �&���&&��&� & &*� &%� &   &�� 8&&� @&+ H&  P&�( `&&� h&<X p&8 x&
� �&  �&�` �&&� �&<X �&8 �&� �&  �&�� �&&� �&� �& �&  �&�!&&�!&H!&�! &!(&�!8& �!@&�!H&%�!P&%�!X&
�!`&�!h& �!p& !x&��!�&&�!�&x!�&H!�& �!�&�!�&B0!�&�!�&�!�&�!�&%�!�&�!�&4P!�&
�"&h"&
�"& "&�"(&&�"0&H"8& �"@& �"H&%�"P&%�"X& "`&�0"p&&�"x&C�"�&� "�& "�&�P"�&&�"�&`"�&`"�& �"�&�"�&�"�&�"�&�"�&�"�&#&%�#&�#&�# & �#(& �#0&%�#8&%�#@& �#H&%�#P&%�#X&
8#`& #h&��#�&&�#�& �#�&�#�&%�#�&%�#�& #�&�#�&&�#�&H#�&%�#�& #�&��#�&&�$&`$&;�$& �$&&X$ &%�$(&
�$0&6�$8&�$@&+$H& $P&� $h&&�$p&�$x& $�&�H$�&&�$�&8$�& $�&��$�&&�$�&`$�&;�$�& �$�&&�$�&%�$�&H$�&%�$�&+%& %&�%&&�% &`%(&;�%0& �%8&&�%@&%�%H& �%P&'�%X&%�%`&+%h& %p&�p%�&&�%�&`%�&;�%�& �%�&&�%�&%�%�&)�%�&+%�& %�&��%�&&�%�&`%�&;�&& �&&&�&&%�&&8& &%�&(&+&0& &8&�0&H&&�&P&`&X&;�&`& �&h&&0&p&%�&x&%�&�&+&�& &�&��&�&&�&�&`&�&;�&�& �&�&&&�&%�&�&%�&�&+&�& &�&��'&&�'& �'&��'&%�' & '(&�('@&&�'H&('P&�'X&�'`&'h&*�'p&�'x& �'�& '�&�X'�&&�'�&`'�&�p'�& '�&��'�&&�'�&;�'�& �'�&&�'�&%�'�& �(&�(&�(&%�(&+( & ((&�(@&&�(H&`(P&�(X& (`&� (x&&�(�&�`(�&`(�&@(�&@(�&�(�&�(�&((�&�(�&�(�&@(�&�(�&
�(�&�(�&�(�&`)&@)&5)&�) &!`)(&x)0&@)8&�)@&()H&)@)P&9�)`&()h&()p&��)x& )�&�p)�&&�)�&�)�&&�)�&�H)�&&�)�T&*T&�*&�* &&�*(& �*0&�*8&�*@&0*H& �*P&X*X&�*`&
*h& �*p&
8*x&�*�&
p*�&�*�Y&*�&�*�d&*�&
�*�&
�*�& �*�&�*�&
        !          8565: *�&*�& *�&&�*�&&0*�[&+&, + &&+(5&+0&�+P&&+Xu&+`&+�&&+�1&�&��x�&�����������H0bootinfo&&���������P(snkELF&&�@&@`@8&@

        !          8566: &�&&&?p2�Q|�����8c��|�#x�&�!��|c"xc H�`8!�|�;���|�||c8�&����|�N� &�&`|�������8`�&�!����肀��P{� ��x��H��`9 �J;�U)0W�0��PW�����|Hl|�|O�|�L&,9)�B��Hi`8!��&����|�N� &�&`|���������|~x|�#x�&�!��8 9`�A���a��|  ���������9@�!�A�"�```8&�i�I9)@|�B�쀢�$�€48�p;����b�(|�0Px� H7`/�A�&�"�8�&p8�;@낀����"���P� {� #�x��x��H��`��x��x8`H��`I�xk�x}kJ9kU)0Uk0}iXPUk��}i�|Hl|�|O�|�L&,9)�B��H]`��x��xH        �`||xH�`$�x��x8`H�
`{�;{WZ0W{0z�PW{��i�|�l|�|׬|�L&,;Z�B��H]`8!���x�&�!���A���a��|���������������N� &�``|�xi �&�!��8      ��+�&@�(+�@�x8`��8!p�&|�N� ``/�@��8&9&p| �|�#x} Cx9@
�8�&� | P9)&�(���/
        !          8567: A�p@�B��`|�HP}Cx�"�@x`6d}i|  ./�A��xxc6d8})*/�A��d� �A(}c[x|     ��i�IN�!�A(K��D``�I9)&K���8�9&pK���&�```|����������&�!����&���&�|dx��&���&��&&��!&��A&�;�p8�&���xH��`��x|~x8`&��xK���8!&���x�&��������|�N� &�```|��&�!��H�`8!p�&|�N� &�|���������8`|�#x�&�!��|�+xH        �`,#A�T�#@/�A�H�      �A(��x��x| ��i�IN�!�A(8!��&��������|�N� ``�b�HK���8`��K���&�`|�+�
��������|x�&�A���a�����������!�QA�d�"�PyJ�|     R�} J})�N� HH&&H&x8HHhxHHH�|�+�@�``8`��8!��&�A���a�����|������������N� `/�A�|A��/�&@���8`��pH5`��p|yA���?/�A�؀/�A��|�;x8�P8�H��``8!�8`�&�A���a�����|������������N� `|�+�A��8�"�@{�6d|i�| �./�A�� �#/�@�&hK��```8!�|c��&�A���a�����|������������K���`�b�@8 |��;�}i[x|     �H`;�&9)@��B@&4�     /�@���{�6dK�뢀X;�HH� �A(C�x��xe�x|     ��i�IN�!�A(/�A��;�&;���/�
        !          8568: A��@�}/�A����+0/�A��؀/�@����+�  �A(| ��i�IN�!�A(�=�)0K��p```|�+�A����"�@{�6d|i|     ./�A����#|��/�A�&`�     �A(| ��i�IN�!�A(K���```��xK���``�b�`��xK��y8`��K��d```8!�|��|�+x|��|���&�A���a�����|������������K���``/�A���/�@��8`��x��pHu`�x��p,#A���#8/�A�t�     �A(|�+x|��| ��i�IN�!�A(K����"�@{�6d|i�|     �./�A����#0/�A���� �A(| ��i�IN�!�A(8`��K��h�b�xK��m8`��K��X8`��p��xH�`�p�x,#A���#H/�A�t�     �A(|�#x|�+x| ��i�IN�!�A(K��� �A(| ��i��p�IN�!�A(���p8`��/�A���K��<�b�pK���8`��K����b�hK���8`��K���&�`|��!���A��; ;@�a������|�+x�"��������|}x|~x�&�&�������!�Q�/� H���x/� ;�&A���@@����P��P{ �xH�U`8�����xx� ��x�{H�i`����?��`�&/� A���<�@@�;Z&;{Z�/
        !          8569: ��x@���8!�8z&|c��&�&���!���A��|��a����������������N� &�|�����|���&�!�1;�p��xK�����xH�
`8!��&����|�N� &�&`|�����|���&�!�1;�p��xK��u��xH�m`8!��&����|�N� &�&`|mB�|B�|�B�| @���xc�|cxN� `}-B�|B�|�B�|       @���y)�})x�b������k}cY�}kykt�}iZ``}-B�|B�|�B�|  @���y)�})x�H@@�8�|     �`B@��B��K���N� `}-B�|B�|�B�|      @���y)�})x�b������k}cY�yk��}kyk�}iZ`}-B�|B�|�B�|  @���y)�})x�H@@�8�|     �`B@��B��K���N� `|�8�Tc0T�0|� PT���|��|l|�|�|�L&,8c�B��N� ``��������|��‘����;��&�!�q;�PH``��;���A�L�?/�A���     /�A����) � �A(| ��i�IN�!�A(��;���@���8!��&�����������|�N� &�8
        !          8570: �"��|  �`�i9)/�A���A�B��9`}c[xN� ``��������|��‘����;������&|}x�!�q;�PH;���A�8�?/�A��� ��@����     /�@�4��;���@���8!��&����������|�����N� �) � �A(| ��i�IN�!�A(��K���&�```��������}�&�†����|}x|��&����!�a.#A�&;�H`�;�.#A����xH��`/�@���A��8   �"��|   �```� 9)/�@�tB���€�9@
        !          8571: ;�}I���x``�  9&/�A��}�9)B��;���8!���x�&���������|�����}�� N� ``8!�;�����x�&���������|�����}�� N� `8!�;�����x�&���������|�����}�� N� `��x8�pH`/�@�X�‸�ap8�x8�肀�H��`/�A�<�"���b��;����)�     �A(| ��i�IN�!�A(K��;���K���!x�b��8�x�     �A(| ��i�IN�!�A({�$/�|~&*A� �/�@���8cPH�`K���;���K����`��������|~x�†|��&�!���/�A�4;�`���@�K���/�@�<�;�/�@���8!�8`�&��������|�N� ```8!��"��xc$�&����|i*����|�N� &�|����������&�!���"���€��B������b���I`�iX9@       9>}I��8```�   9)B���†�/�A�;�K����;�/�@���9`
        !          8572: ��x}i�;�```�      9&/�A�4}�9)B��8!��&��������|�N� ```H,1`8!�{�$�&|~�*��������|�N� &�`|�3x|�;x|&x|��B�`&��kt}��(|!B�A@��8�H|BB���€����B���*K���8|���A@�!N� |��&�!��|�3x|�;xK��e�!�&|�N� �"���!K����b���#��&0}���A@�aH�P�X��`��h�&p�!x�A������������&��!��A��a������������&��!��A&�a&�&�&��& ��&(8!&0�&H|��&P|��&8|��&0�a@8!XL$���`N� ``|����������&�����!�q���xHQ`��/��A��肁08�8�H
�`�/�@��x� 8�&K��`|}yA����xH�`/�|dxA���b�P��H�`/��@����8`8!��&�����������|�N� ``�"� �b�(�)�     �A(| ��i�IN�!�A(8`��K����"� �b�8�)� �A(| ��i�IN�!�A(8`��K����"� �b�HK����"� �b�@K����"� �b�XK���&�|�������|dx�&�!�a�/�A�@8�p8�HE`8/���A��&r8!�|x�&����|�N� `���K��=���K���&�&|������&�!��K��/�@���b�`K��a��h��b�pK��Q��b�xK��E��b��K��9��b��K��-��b��K��!��b��K����b��K��   ��b��K���� �b��K���$�b��K���(�b��K��ِ,8!��&����|�N� &�&|���������x�d�&����/�|�3x�!�q���8}`Z�!��&�����A�������P9!�@�49D��|xyJH9J}IR`9)�P�   ���9k@���/�@��;����P8{� ;�&{�d9=��y)��9)&})�9 `|I.9)B���"���x��H'�`/�A�,�P9 ```|H.|I.9)��@����?P�i8!��&�����������|�N� �"���x��H'e`8`K���&�```�"�h|�8�8�&�&�!��8 8` � ,8�pK��i�b��K��`�ar8!��&|�N� &�``|���������|~x�&����8|�#x뢁h�!�a�}*/�A�$|�+x8�8�&8�p��x��K����*�r�b��|x��x��xK��`�ar8!��&�����������|�N� &�`|��"�h|kx8`���&�!�a8���&���&/�A�D���|�3x8��+�K8�&8������k��p�ax�&�K��-�a�8!��&|�N� &�``|��"�h����|x8`���&�!�A8���&��     "/�A�D|x8&��&p8&�8��&x8�8&�8��8���&�9&�9!�9A�K����a��&���&���&���&���&���&���&�8!���&����|�N� &�&``|��"�h�&�!���i/�A�8�8�&8�pK��   �ar8!��&|�N� &�`|��b�h|ix�&�!�q|�#x�k/�A�(9`8�&�!��&�8�&8�p�ax8�xK����ar8!��&|�N� &�``|��"�h|gx�&�!���i/�A�8�&8�&8�pK��E�ar8!��&|�N� &�|��b�h|ix�&�!�q|�#x�k/�A�(9`8�&�!��&�8�&8�p�ax8�xK����ar8!��&|�N� &�``|��"�h}Cx�&�!�q|`x�i/�A�/�@�HT�@.�i
        !          8573: |�;xT��|�+x|�#x8��|��}i[x8�8�&K��Y�a�8!��&|�N� T�@.|�;xT��|�+xx   �ap|�#x8��|v|��8�8�&K���a�8!��&|�N� &�```|��"�h�&�!��|`x�i/�A�/�@�L�i/�A�,T�@.|�;xT��|�+x|�#x|��8�8�8�pK����av8!��&|�N� T�@.|�;xT��|�+xx  |�#x8�p|v|��8�8�K��E�av8!��&|�N� &��"��8&8`�     N� �"��88`� N� |�#xN� ```|�#xN� ```8`N� ```|���������||x|�+x�&����8�L|�#x�����!�!8�;�p��xH��`�����x��|�&p���8�&t���H �`8!��&��������������|�N� &�```|���������|}x|�#x�&����8�8�L�!�!;�p��xH�!`�����x��|�&p���8�&tH 
`8!��&�����������|�N� &�```|���������|}x|�#x�&����8�8�L�!�!;�p��xH��`�����x��|�&p���8�&tH}`8!��&�����������|�N� &�```�"�� /�M� ���iK��X``|���������|~x8��&�!�18�L;�p��xH��`8&��x�"���|�&t�&x�!pH�`�a�8!��&��������|�N� &�`|�����8�8�L�&�!�1;�p��xH�a`����x�&p8&�&xHU`�a~8!��&����|�N� &�&``|���������||x|�#x�&����8�|�+x�����!�!8�L;�p��xH��`����x��|�&p���8�&t���8�&xH�`�&��a�8!�|4T�~x ������|���������|c8�&|�N� &�``|��a������||x|�3x�&����|�#x8���������|�+x8�L�!�;�p��xH�`�� ��x��|�&p���8�&t���8&�&x�a�H�`�a�8!��&�a��������|���������N� &�}�&|�.&����|�#x�&���!��A��肂08�p8��K��!/�@�x9!�H@```�     ��}c���@A��i��|x �@@�`/�9)@�49c��9I��@��Ȉ     ��}c�/�A���/�9)A���``8`��8!&`�&������|�}�� N� �jxcG�/�@���8!&`8`�&������|�}�� N� 肂(K��$�&```|���������|~x8��&�!�18�L;�p��xH�Y`��8��x��|�&p8&�&tHI`8!��&��������|�N� &�```|�|iy8`���&�!��A�8� �)8�iK��Y8`8!p�&|�N� &�`|���������|}x|�#x�&����8�L8��!�!;�p��xH��`��@��x��|�&p8&�&t8�&xHi`�&���a�8!��&�����������|�N� &�```|���������||x�&����|�#x�����!�H�m`;�x8�8�L|}x��xH��`��H��x����&x���8�&|8�&�H�`�&��!��a�8!�x�|Kx��&������|���������N� &�``|���������|~x8��&�!�18�L;�p��xH�)`8&��x�"�P��|�&t�&x�!pH`�a�8!��&��������|�N� &�`|���������|~x8��&�!�18�L;�p��xH��`8&��x�"�X��|�&t�&x�!pH�`�a�8!��&��������|�N� &�`|���������|x|�#x�&�!����K��a�"�|`x/�8`��{�d���A�<��B�p9)8`�b�`��h�_0��yd})B�?89 &�?8!��&��������|�N� &�|���������|~x8��&�!�18�L;�p��xH��`8&��x�"�x��|�&t�&x�!pHu`�a�8!��&��������|�N� &�`|������b���&�!��K��m/���A�D;�p肂�8���xK�����xK��I|`x8!�|x�&����|�N� ``�b��K��/���|`xA���;�p肂�8���xK��]K���&�&``|���������|~x�&�!�qK��I/���A�<肂�;�p8���xK��
/�@� /�A�<��x��x8�H�}`8!��&��������|�N� ```��x8�r8�H�E`8!��&��������|�N� &�``|���������|~x8��&�!�18�L;�p��xH��`8&��x�"����|�&t�&x�!pH�`�a�8!��&��������|�N� &�`|��!���&��8�&��&������������|�#x��������|x��x�������������A���a���!�!�"��$�x;�|��xK������x8�K��E/���|~xA����x{� K���:�t:�x;&p|}x��xK���|{yA�``�B��~ųx8���xD�xK��=肂�8�~�x��xK��)D�x�x8�c�xK���&t�Ap��x��x肂�8�&�Z�&xZK���{Z /�A�&�/�A�&X��t�!x{U(��x��p|uP~��9     ��{Zd|�"y�x�d|�*9z� xc }B,�/,$�Gy@G���A�A�d|�+x8A� `�i9)x��@|[x@���A�&HA�&x|�;x9 |��H�Ky)�}IKxB����|     �0@A�4|c�|��xc }�|�/�@�x|��K��l```�0@A���/�A��/�8A�<9L��x�dyJ }gZ9J&}I�```�Kx�9k|SxB��})0P|     ���x8�&�$�x��xK��q}�xc�x$�x��x8�&�K��Y��xK���|{y@���8!��&����������|������&���!���A���a����������������N� `�'�gy)�})[xK���8&xd}G}g.�
        !          8574: yk�}`xK��D9 K������x8�&K��i|~xK��,&�|�����|x�&�!��K���8!�|dx��x�&����|�K��p&�&|����������&����8�����!�a�&x�&pK���|~yA��낂(��x;�xH ```K�����x|yA�d�&x��x��x8���x�&pK���/���xA���8ap��xK����ap8!��&����������|�����N� ``8!�8`�&����������|�����N� &�|���������|x�&���������!��K��q8��/���|~xA��K���낂�;�p8�@��x��xK��%肂���xH�)`/�A� 肂���x8�
        !          8575: H�`/�@�`8&肂(8���x8�0��xK�����x8��8�@�|��xK��88!`|x�&����������|�����N� 8肂�8���x8���x;��;�xK��q肂�8��8���xK��]肂�8��8���xK��I肃8��8���xK��5肃8��8���xK��!肂0��x��x8�&�K��
8��/�@��L�&�x  �"x�"���?�``�8c��|c�T>xG"9k��/�yk�yi&�ykd}+HP}=J9) �     �� �;��     A�����xK��-8��|x8!`�&����������|�����N� &�|���������|~x8��&�!�18�L;�p��xH�y`8&��x�"���|�&t�&x�!pHe`�a�8!��&��������|�N� &�`|���������|~x8��&�!�18�L;�p��xH��`8&��x�"���|�&t�&x�!pH
�`�a�8!��&��������|�N� &�`|���������||x|�#x��������|�+x�&�a���!��� ��xK��M/�@�@;ap8�c�x8�LH�Q`8c�x��p��|�&t������H
=`8!��&�a��������|���������N� &�`|���������|�#x|�+x�&���������a��|x�!��ƒ(��xK�����x/�@�L;ap8�8�Lc�xH��`8c�x��p��|�&t���8&�&x���H�`�&�8!�|x�&�a��������|���������N� &�|��A���a��|zx|�#x�&����8�|�+x��������8�L;������!�;�&;�p��xH��`��0��x��t�&p���8�&|H�`��x8�8�LH��`��8��x��t�&p��x�A|�a����H�`�a�8!��&�A���a�����|������������N� &�``|���������||x|�#x�&����8�|�+x�����!�!8�L;�p��xH�       `��@��x��|�&p���8�&t���8&�&xH
        !          8576: �`�a�8!��&����������|�����N� &�|�|iy8`���&�!��A��)8|���iK��=8!p�&|�N� &�```|���������||x|�#x�&����8�|�+x�����!�!8�L;�p��xH�`��H��x��|�&p���8�&t���8&�&xH        �`�a�8!��&����������|�����N� &�|�|iy8`���&�!��A��)8|���iK��=8!p�&|�N� &�```|���������||x|�#x�&����8�|�+x�����!�!8�L;�p��xH�)`��P��x��|�&p���8�&t���8&�&xH         `�a�8!��&����������|�����N� &�|���������||x|�#x�&����8�|�+x�����!�!8�L;�p��xH��`��X��x��|�&p���8�&t���8&�&xHi`�a�8!��&����������|�����N� &�|���������||x|�#x�&����8�|�+x�����!�!8�L;�p��xH��`��`��x��|�&p���8�&t���8&�&xH�`�a�8!��&����������|�����N� &�|��A���a��|�3x|�+x�&������������|~x|�#x�b���������������&���!���!�AK����8��/���||x��_@�L8!�|x�&���������&��|��!���A���a����������������N� ```�b�h��`8:�&��h�B�p; |x肃p8��8�[0���;���K��A8��@��H8��x�[p|x��x�P�;X肃xK���肃�8�&K��&8��/�A��,��xK��}/���A���b��K��}/���A� K���/���A�肃���x8�K��K���`������8��B���b���"������(�> ��&0�&(�^h�~p���K���8�K����>�b���   �A(| ��i�IN�!�A(K��\&�
        !          8577: ```|���������||x|�#x�&����8�|�+x�����!�!8�L;�p��xH�9`�����x��|�&p���8�&t���8&�&xH`�a�8!��&����������|�����N� &�/�A��/�A�T/�&8�A�|�#xN� ```|ex8�&8`<D"/�x� A���8��K���```|ex8�8`<D"/�x� A���8���x� |�#xN� `|ex8�8`<D"/�x� A��t8���x� K��h```/�|`xA�X/�A�0/�&8`��L� x� |x8`@8�&D"8`N� `|ex|�#x8`@8�D"8`N� `|exx� 8`@8�D"8`N� ``|�|�;x�&�!��8T:|�+x|�|�#x8�K��)`8!p�&|�N� &�`|�8�|�+x�&�!��T�:|�#x|��8�K��`8!p�&|�N� &�``|��A���a���&����||x��������|�#x|�+x�����!�a;�W�:����x��x��x8�K��5`9����x��x��x|zx8���xK��A`��x��x��x��x8�K���`��x��x��xH�x|{x8���xW{:K���`8!�|{�|c��&�A���a�����|������������N� &�``|��b���"���&�!��8&�b���)�    �A(| ��i�IN�!�A(8!p8`�&|�N� &��"��88`� N� 8`N� ```|��"��|�#x�&�!��|`x|x�iK���`8!p�&|�N� &�```|��"��|�#x�&�!��|`x|x�iK���`8!p�&|�N� &�```|����������&�!�q�b��;�p��xK���`�ƒ���x8��~K��`/���@�,8`8!��&��������|�N� ```�~��x8�K���`/���A����b��K���&�肄|���!��|���&N�!�&|�8!N� |��N� ```�"�9I�     /�A�0}`=J �P@8`��M� �i|xN� ```}@Sx�I=J }`8`���P@@���N� `8DN� ``8DN� ``8
DN� ``8D|c�N� `8D|c�N� `8D|c�N� `|�#x|�+x|�3x|dx|x}%Kx8       8`&D|c�N� ``|�#x|�+x|�3x|�;x}   Cx|dx|x}�cx}FSx}g[x8       8`D|c�N� ``|�#x|�+x|�3x|dx|x}%Kx8 8`D|c�N� ``|�#x|�+x|�3x|dx|x}%Kx8 8`D|c�N� ``�"����ixc��|cxc�|c�N� `�"��iN� ``|v�N� ```|v�|c�N� ``�b� N� ```��������|x|�3x|�8c�&�!����|�+x8�Hx�`��x��x8�Hx�`8!��&��������|�N� &�`|�|�#x8��&�!��|dx8`K��E`8!p�&|�N� &�|�|dy�&�!��A�0�b� 8�Hx5`8!p�&|�N� ```�b� 8�8�Hw�`8!p�&|�N� &�|���������8�8���&�����!�a�„ ;���xHwu`8`��x8��8�K���`8,#@�,8!�|x�&�����������|�N� ``x} +�
A�8��K���```肄(��x8�Hx5`/�A�<肄0��x8�Hx`/�A� ��x��x8�Hw�`/�@�P�/�A�(/�@���8���8~|��H�`|`xK��88���8~|��H1`|`xK��|$x833��x8��pHw�`/�A���8��K���&�``�"�8�iN� ``�"�8�iN� ``�"�8�iN� ``�"�8�iN� ``89 ���� ���
        !          8578: ����8�&�#8E���N� ``�"�8�iN� ``�"�8|���������;��&����8;������!�q��x�  �     ;�� ��{�>${�M�|`P8�|P;�&xcd||8�8c��Ht�`/�
        !          8579: ���;��@����"�@��H8!��������      �&��������|�N� &��"�8�iK��8``�"�8�iK��``�"�8�iK���``|�=# �&�!��<�`���@A�T�"�P�b�8x`�bTj�>8!p� �I8^�     �i8�     &�k8&�     �&|�N� ``�"�8�b�P88��8��     Hs�`8!p�&|�N� &�`|���������}Cx|�;x�&����8|�3x�����!�q|x���8|�+x�88��8&�8cHsE`����x88�Hs-`8!����&����������|�����N� &�`|�+������a��||x�&�������������!�QA�88`��8!��&�a��������|���������N� ```�/�&@��Ġ/�@���뢄8��=�@����#/�&A�4/�@���K��1`8�8�HsA`/�A��8`K��l/�A����;�8�8�*�&p;�xM�x     >$})XP|HPxd�;�
        !          8580: ��xHq�`K���`8���x|ex��xK���`K���`���&p��x8�|ex8~K�����x8�*K��&`8`K��ā|/�A���<��́=����x`���y >$y%M�|(P�8@|      P9I&xd�A��|�?�XA�$|
        !          8581: 0T��T        8T<} J})PPy) K���;�肄X8��;���xHq�`|{y@��(8���x8�Hp�`�/�@���;�
        !          8582: ��x8���xHp�`���xK��`�8`K���&�``}�&|���������|�#x�&����8|x+�������&��8`���!���A���a�������!�!A�&��/�A�(/�&A� �„89`
        !          8583: 8}i��
        !          8584: ��x��x;8``�i9)|ZB��x       x�| �?   x�|/�|��
        !          8585: A�܂�z� /���A�&Ё>} H�~�8�A�&����A�\�|�x|H8,@�X�>�~�H@A��y*M�y >$|PP=��|      Pa��x
        !          8586: d}^R�J��@�H�`�J��A��9)&|    @T��T
        !          8587: 8T<|R} HPy) y*M�y >$|PP�H@|    Px
        !          8588: d}^R@���;��b�X�"�`.<y`>$yxM��P8��P8�*{d�;[;�
        !          8589: ��xHni`K���`��~�x8�&G�x|ex8xK���K��]`8�F�x|ex��xK��e`��x8�*K���`A� 8`��8!��&�������&��|��!���A��}�� �a����������������N� ``�„8��K��܀|�x|H8,@��L��B�X;�x  >$xM�})XP;Z|HPxd�K���`;�
        !          8590: F�x{� 8�|ex��xK���`��x��x8|;�Hm}`��x��K���`8!��&�������&��|��!���A��}�� �a����������������N� ``�>�~��H@A��,y*M�y >$|PP<���|  P`���x
        !          8591: d}^R�J�@@� H````�J�@A�H9)&|    8T��T
        !          8592: 8T<|R} HPy) y*M�y >$|PP�H@|    Px
        !          8593: d}^R@���K���xd;>�.<A��b�X;\8�C�xd�xHmY`/�@������~K��l```��B�P;�x    >$xM�})XP|HPxd�K��X``�„8����K���``8;Ap�C�x8�8�Hk�`�;�       ����&y�a|/�8����!rA�,8   ��9T<}k8�<;��X|J@���9a�``�:;Z�X|J@���x  x�| x     �|     |��K��|�>�=@��aJ��8 &y&M�}`PUk��Ug8Uk<}k:y'>$|P|�0Px |     8Pxd�X�~�@�$9k&}+PU)��U*8U)<})R}iXP�~�?8�8�}9&.8|{� Hja`K��y`f�x8�|ex8|
        !          8594: K��`��x��x8|;�Hji`���8`K���b�X�~K��x�      ```�"�8|�/����������&�!�|`x�i@�8!��&��������|�N� ;�p9@E�Ap9@;��9 9`�_&�9@p8�_�9@��8a��_�9@&8�*�_   �?
        !          8595: 8�T�?�&�8�v��>8&��~&Hi9`��x9A�8`�i9)�P|Z@���x       x�| ��xx �|     8�p|��K���8!��&��������|�N� &�|���������|�#x�&�!���A���a�����������!�Q�|?x/�A�&�/�A��/�A�88`8?��&�!���A���a��|���������������N� `�DmK��/��vA�&�8?�8`���&�!���A���a��|���������������N� 82�!|:xx�9`E|�;`}!&j�9%;�x� %�x;�p;���x�>�~9 ���~�>9`9 &�~&�>       ����~��
        !          8596: Hg�`�~��9`.��x}i�8```�i9)|ZB��x   x�| 8�x �|     ��x|�|���K����&8`�A�x8?��&�!���A���a��|���������������N� ``�/�A�,/�@��\8�����&8ix� H
`8`K��@8�����&8ix� H=`8`K�� �$/�&@��T�"�8�c�I�X@��@/�A��8� 8`K���&�```|�+���������|x�&�!��@�@�„8�>/�A�T�_y@ �@A�t/���A�l�>/�A�`�H@A�X8`��8!��&��������|�N� ``�_=`��ak��y@ �X@@���= ��a)���H@A���K���`9`
        !          8597: 8�
        !          8598: }i��
        !          8599: ��x8�8�i9)|ZB��x   x�| x     �|     |�T>�@@��\�x �@�4x ��A������x8~;�He]`8`K��0```;�;���~�A�8`K���~   �     �@���~��@��܀�P@��Р�y)$8i8���|~x� Hd�`�x��@����?T8��x��x|J��     /�A�X/�A�4/�&@��x8!���8�8����&����|������|�K��t��88���|��H�`K��8��88���|��H&�`K��&�```8�������N� ```|�+��&�!��@��/��A�8!p�&|�N� |�+xH%�`8!p�&|�N� &�``|�x� +��&�!��A�8`��8!p�&|�N� `�/��A�Hl
        !          8600: ��/��&A�L/�D@��̠/�C@���9)��8c}$�H�`K���```H-A`|ctK����/�5@���9)��8c}$�H&�`|ctK��h&�```8`��N� ```N� �"�h�i8`N� `|��a������|{x;���������|�+x|�+x�����&|�#x�!�a```�?|�P��x��x})tU+28�&|J/��x� ,��/)A�\A�lA��Ha�`�?})t8        &��|�P��x��x�?})tU+28�&|J/��x� ,��/)@����;�x���K��d/��>A�p8!���x�&�a��������|���������N� ```肄p��xH^I`8!�8`�&�a��������|���������N� ;�&K���&�`|���������|x�&�&���!���A���a�����������!�Q�/�4A�88`8!��&�&���!���A��|��a����������������N� �T(mi��/��@���x !@�h�;�/�A�x낄x;�H``�;���@�T��x��x��x;�&K�����,#@���8`��K��\``�"�h8&8`� K��@```�/�A��$�b�h;�;;;�;[&8�xH ``;�&�����@�����x��x��xK��1|~yA��x�/�&@���D�x��xH\&`/�@�4�/�&/A�dA�@�>8     
        !          8601: �K���```��x�xH[�`/�@���K���`8�
        !          8602: ��x%�xK���/�@���8`��K��D�
        !          8603: 8`�K��4&�`|��!���A��;@&�&�a��|{x�����������������!�QH[�`뢄h8�;�;�{� ��x;�(;=8{� {� ��xH^=`9=,84�,8&d�x#�x�      �IH[U`c�xH[�`8�8�x� `��&8c&8�5xc }9Y.8}$�IK���`��8�(��xx� 8�8�K��`��x��K��e`8!��&�!���A���a��|���������������N� &�`|��!���A��|�#x�&�a��8��������||x��������������&���!�A�B�p�b�h;�    D�x��x��xHZI`肄���xH\        `/�A�肄���xH[�`;�뢄���x��xH[�`/�A���x��xH[�`;�&뢄���x��xH[�`/�A�&���x��xH[�`뢄�||P��xxx ��xH[u`/�A�&���x��xH[]`�P{� ��@@��x{�!A�+��@�T�b��Hf}`8!�8`�&�����&���!��|��A���a����������������N� ```��x��x��x;&HZ1`8D�x|��x�xHX�`��xHY`+��A��;�  &�xH8```HY�`���P}}�/�A����x;�&;�&�}>�P;�&|��Py) /�.x� ��x��x/ (�?A�@��ș+@���~�xD�xHXE`�b��HeY`8!�8`�&�����&���!��|��A���a����������������N� ``��xHX-`뢄�xx ��x��xHY�`/�@��4`��xHW�`x} K��4```��;/�A�&��;�D�x��x��x;�~�xHWq`��xHW�`/�A����xK��qK���`K���````K��Q`�/�@�@�
        !          8604: /�@��K���`/�A���;�&��/�@����b��8�Hd    `8!�8`�&�����&���!��|��A���a����������������N� ``�xK���K��L`�b��Hc�`8!�8`�&�����&���!��|��A���a����������������N� ```8!��8`&�&�����&���!��|��A���a����������������N� &�       ``|���������|}x8��&����8�&V�!�q�&|?x�&��;�p��xHXy`����x;�8�&H8�8�K��`��x;�8�C8�D8�&4K��]`8&9 肄Ș&�=8~��HUY`K��1`8�|dx8~8HX=`����xK��`8?�8`�&�����������|�N� &�``|������&��8�8���&�!��|yx;�A���a�������������������!�A�&|?x�&�!;�p��x;]"HWY`;�;}*K��   `:�F^�xK��`8`��x8��8�K��q`/�A�&�\
        !          8605: �
        !          8606: ��x8�i9)��|Z@���x   x�| x     �|     |�T>�P@�̈   /�@���/�D@���/�C@���/�@��K�ݹ`~�x8�HW�`/�@�|�"���i/�A�d�x8��HV�`��;8y8�l��9HS�`8?�8`�&�����&���!��|��A���a����������������N� K��&`/�A���8?�8`���&�����&���!��|��A���a����������������N� &�   ```|��a������;e&�&����8|}x�b������{~ �����|�#x�!�aH_�`�"��낄�������x��xH_�`/���xA�TK�����x;���K��u{� /�@����b��H_q`8!�8`�&�a��������|���������N� �b��{d H_9`8!�8`���&�a��������|���������N� &�```|��A���a���&����|�3x��������;�&|�#x�����!�a{� |x��|�;d��;Ape�P`�P{{ |� Pe�x|�"C�xHTm`��|&D�xe�x|c|{P|HTI`���&8�{P|�HT-`}?讈&|     |鮈&�>| �8!��&�A���a�����|������������N� &�|��!���A��|�3x�&�a��|�#x��������|�+x��������|x�&���!�A�/�;!pA�X�c9 /��@� H&�}ISx�H@@�8}H�/��A�&�9I&/�yJ 9)A���}P�})Zy) �H@A���;�;{� ��@@�(}]���/�@�`;�&��{� ��@A���8!�Cx|ct�&�&��xcт�!���A��|��a����������������N� ```/��A�̀��x�!A�t�9 �@A��/��@�4HX```}i[x�H@@�@|H��@/�A��A�,9i&/�yk 9)A���|X�})y) �H@A��Ȉ�&x� ��x|:8�HR`�{�<&8|J��&;����K���`8!�8`&�&�&���!���A��|��a����������������N� ```�;K��l``�9}%Kx��xd�x��xK���K���&�``|��a���A��|�#x8��&����|�+x8���������|~x��x�����&���!�������!�AHP�`肄���x8�HR`/�@��:�;;�;�&; {� ��@@�X|��}>��&�|��/�4A��+�4A�x/�A�P+�A��/�@�&;�&��{� ��@A���``8!�cx|ct�&����xcт�&���!��|��A���a����������������N� /�BA�&�+�BA�d/�5A��/�6@�d�     ;���     &���K��(`/�A��/�2@�4�     ;���     &���K���`/�CA��/��A��     &;����K���```/�&@��ܘ&;�� �� &���K���``�i8��T>+�A�&@�};��     &���K��h`;_&8�|�"�x;�|�ЮHO)`}>Ю}=J�)|Ю���K��(`��;��     �� &���K��8!�8`&�&�����&���!��|��A���a����������������N� ``;_&8�|�"~�x;�|�ЮHN�`}>Ю}=J�)|Ю���K���`��;�� �� &���K��d� ;���     &���K��H`8!�8`�&�����&���!��|��A���a����������������N� &�     ```|���������|�#x8�肄��&|}x�����!�qHM�`�+�@�$8!�8`�&�����������|�N� |t9 &} 6p&�A���9}85�;��+&���/�A�84��?&��;�
        !          8607: �2/�A� 82�8�&��;��6/�@��9`&��x}i���x8``�i&9)&|Zx B��/�A�@9 7�&�?;�9 �j&8  &9J&/�A��?;�&x  /�&@��܈B/�@���C/�@�L8��8!��8`&�&�����������|�N� 86�8�&��;�K��08C;����xHII`��x8�&8x� ��&HK�`�?&8     �K��x8B;����xHI`��x8�&8x� ��&HK�`�?&8     ��C/�A��,K��p&�``|��a���A��|�#x8��&����|}x8����������!�������!�;�t��xHJ�`�/�A�@8`��8!��&�!���A���a��|���������������N� ```���/�A�/��A����x{e HJ�`肄�;]�8�C�x;���HK�`/�A���};},�=�c�x�?�HG�`/�A�(��/�@�d�x88�@HH}`��X;�l��xHGy`/�A� ��x8&8��HHM`8�&�88`�8!��&�!���A���a��|���������������N� `��x8��HI�`K��```{{ C�x8����xx� K��=/�A��x�&�/�@�\�&�/�@��=�;},�?�c�xHF�`/�A���/�A��;�l��xHF}`/�@�`��8��K�ԩ`�&u/�A��&w/�@�T�&z/�@�8`K��Ѐa|K��Q`8`K�����x8&8��HF�`8�&�K���d�x88�@HF�`��XK��T��/�&A�8/�@��h/�A�&�/�@���89 �?�8`�K��@/�@��d�;� 8���&t8�&H��x�;��HG�`9?<8��<� ��&K���`8�|dx8XHG�`8�8���xHG�`88���8�8a��&�HG�`8�8����8a�HG�`��x8(��ϛ�Λ�›��������K���8�&48�D8�C84K��U`8�����xx� 8�&H8�8�K��u`��x8�&HK���`88`�K��9;�;a�y) D�x8�c�x�!px� HG
`�&�/�A�&/�A��/�&@���8a�8�p8�l8��K��   /�A�����pc�x��x8�x� K��Y/�@��,K����a�K��`�a�K���`K����a���=�/��&t�?�A��88��HCa`���/�A�t8&8��HCE`8�K��;!�;Ap#�xD�x8�l8��K��I/�A���#�xD�x8�,8�@K��-K��$8a�8�p8�,8�@K��K��肅;�&��xHB�`�&�/�&A���/�A��|;�l��xHB�`/�A��d��x��x8��HC�`��&�K��H肅;���xHBu`�&�0��T>+�&@����/�@�����x8�,8�@HCq`��XK���&�`|��a������8�&H8��&����;�&���������!�A��;� ;�<��xHD�`8��&��<8��肅;apHA�`K�˙`8�|dx8XHD�`�8�8��c�xHDI`�9 d�x���8(�&p�!�K���848�&48�D8�CK��1`������x8�&H8�K��U`��x8�&HK�ӥ`8!��&�a��������|���������N� &�```|���������8�8�&H�&����;�&�����!�Q�…;� ��xHCm`9><8��<;�p�       ��&K��m`8�|dx8~XHCy`8�8���xHC%`��x8~(��&���&������&q��&v��&sK��m8~48�&48�D8�CK��   `��8�����xx� 8�&H8�K��)`��x8�&HK��y`8!��&����������|�����N� &�`|��A���a��;@�&����8||x��������;������!�a���;ap|t/�|x/A�&,A��HD�`/���xA��뢅��xHA`��x/���xA��HA&`��x|P|}4{� c�xH@E`}!����Ip8�c�x8�
        !          8608: ;�&HF`|c4T`>+��A�<��4T@.|`�|�|t/�.@��@�&|tK��4``8`8!&��&�A���a�����|������������N� `��xc�xH>i`c�xH>�`�K��P```k�|c4Tc�~xc K���&�|����������&�&��8|�+x�!���A���a������|{x|�#x��������;�&�����������!�!���…;?&;_��x#�x�&pW�x��xH=�`��xC�xH=�`��b�;`&HJ�`�… ;�����x����xHJ�`HLE`/�A��/�A�&�K��m�:�K���`K���`K��Q`�/�/A��A���K���`/�A���:�&~��/�@���;�����x����xHJ`HK�`/�@��|```�b�(HI�`8!�8`���&�����������|��&���!���A���a����������������N� `�b�8HI�`�/�A���/�A���/�@��~�xH<u`/�A�&;�p��xK��]/�A���&p�?�8|$�x�<H;�`8`8!��&�����������|��&���!���A���a����������������N� #�x8�H;�`K��h```C�x��xK���`/�@��l�8`��/�A����&pK��X�b�0�xHHy`8!�8`���&�����������|��&���!���A���a����������������N� �8`��/�A���&pK���&�```�"�@ c��8&�      �iN� ```|���������|�#x�&�a��뢅@���������!���
        !          8609: }  P}+�q@����H�?/�A�\낅P�Vp��x|��HGy`8&��9 �8�8!&�?�&�a��������|���������N� 낅P|Vp;ap|�c�x��xHFY`�&p/�A�(i�x9````�i�      &/�@���c�xHF�`K��P��H�?y+�A��09)&/�y) @�� K��X&�|���������|�#x|~x�&����8�8�&�a�������!�a;�p��xH<   `�"�@�       /�A��;�8`;`��x8�8��K���`8���"�X��x�d�x�)� �A(| ��i�IN�!�A(8!&��&�a��������|���������N� `�)��x8� 8�8�;��;` ��K�ű`8a�K��`&�`|��a���A��8�8�&�&���������������������&���!���������������!�!�"�`�     �)�!p�&t;avc�xH:�`��@�/�A�&��…h;:�;@;�p;��;88cH8`|tx��xH8`|ux��xH7�`|vx��xH7�`|��8�E8�8��|��|�~�xx� K��]`8&��;�xH7�`�x8�&#�xx� H:I`�8cH7y`8&��xx 9H7a`��x8�&#�xx� H:       `��xH7=`8&��xx 9H7%`��x8�&#�xx� H9�`��xH7&`|x��xH6�`8&��xx 8�&|yx� H9�`�"�Xc�xD�x�)�   �A(| ��i�IN�!�A(8!&��&����������|������&���!���A���a����������������N� ```�;�p;�:��8cH6=`|xx��xH6-`�…h|zx��xH6`X�;&�;Z"|yx��xH5�`�?Z�8�8�Zc�xZ���{D K�±`K���&�``��������|���@9`/������&�!�q8|�#x��$�� 8��(�_���8��0��@�/��A�&p}%�肅p8��xHA]`�b�xHB`8�8`��K��1��@K��Y`K��q`K��YH,K���`�?0� �i�@A��)�@A�l�/�@�&@K��M`/�A����=0�i+�@�p�B�H��/���A�Р}H+�&@�dx� K����=0�iHP```8��8`�א8�@8!��&�����������|�N� �B�H�
        !          8610: /���A�d9k&�iK��i`K���`K���`�?0� �i�@@��8��8`�ؐK���```9 �K���``�H/�@���U`�/�@����b��H@�`K����=0�iK��p```�}8�@/�@��$�N8`��K����b��H@M`�R/�@�,�N8!��&�����������|�N� ``�b��H@
`�NK���&�|����������&�A��|�#x��@����|}x�a�������!�a�@/�A���N8`;}K���K��`K��`�낅H��|�4/���A�&</�A�T    >/�A�x/�A���?08`�i8&�     8!&��&�A���a�����|������������N� 8!&�8`�&�A���a�����|������������N� `�T >+�@�&�8��8`���`8&�8!&��&�A���a�����|������������N� �?H�{9I&yc }@��A��m*��/���A���@A�LA���?0Uk>8`�֐     �i8�֐K���```{[ }�;�
        !          8611: ��@@�&�…hHD`��x8�H0)`,#A��8c&8�H0`,#A��;�&��@@����xH1&`��x8�&��xx� H4�`/�@�����xH0�`8�8�
        !          8612: 8c&|}H6=`xc 8���8T>+��A����8`K���8`K��$``�"��x�|  �} J})�N� ���h&8&(���h&&���h�``��8�8;�p8���x8�&H2�`�/�A�&�;�8`;`{� 8�
8��K�Ι`8�"�X��x�8d�x�8��)� �A(| ��i�IN�!�A(8��8`���K���```88`�8K���8`K��``8��8`���K��t8��8`���K��d8��8`���K��T8��8`���K��D8��8`���K��4�_H�?N�0���$9I��}J*�8�@�88��8`���K���`�_(/�A��@+�&A��8�HK���`�@8���8�x� |cJH1m`�{��K��݁?L�8�9)��9k�| �L@���?Hm ��/���@��(�(/�@��8��8`���K��\K���?0�P8`8&�i�P8&� K����?��x8�!8�8�;��;`!��K���`8a�K���8&8`�K��|��K���&�```}�&|���������|vx8��&�&���!���A���a������|�#x8���������������;��a�����������!���{H4A`8�8�;A�;�t|xx�{H4!`8�8�|yx�{H4       `88�8�
        !          8613: |wx�{ �&pH3�`8�8�
        !          8614: |}x�{(H3�`|~x�b��H9�`�b��H9�`8�8�&C�xH/A`8`8�8���xK���`/���@�l``H;1`/�A� �;�&��/�XA� �K���`K���`K���`/�A���8`8�8���xK��A`/���A���/���A�
���t��u��v��w�&x�!y�b��H8�`��xK��q`/�@����0~óxHI`.#|ux@�L8�&&��b��;�&��/�A��@��8X�&&�8�&&̀&&�|P|�/�WA��8X�&&�C�x��x8�H.=`�/�A���&&�/�&A�/�A�&t;��/�A�(����b�x� x�Fxņ"x��"H8
`;�+�&@�
        !          8615: x�&&T;��/�@�����b���x�x� x��"x��"x�FH7�`�[��&���C�x$�x��x��8�|K��`�&&�/�|~xA��/�A�D/���A��/���A��/���A�        D/���A��/���A�
        !          8616: t/���A�
        !          8617: �/���A�
        !          8618: �/���A�@/���A��8+�@��/���A��/���A�    �/���A� @8!P��x�&���a�����|��������}�� �����&���!���A���a����������������N� �b��H6�`��&�~�xD�xK��m`|x/�@��l/���A�Ȁ���b�x� x�Fxņ"x��"H6y`/���@��h���肆;�&�;�����xx� x�Fx�"x��"H5�`8�&�8`0K���`��xH)I`8��|dx��xK���`K���``8�8�|8a&T;�&�H+�`�b��8C�x�&&�8X��x�&&�8�8�&&�H+�`�/�@��h;�p��x��x8�H,}`/�A��H:�&���x~óx8�H,]`/�A��(�&&T/�A��~ijx8a�8�H+5`8�&&�K���Vp�b� ��x|��H51`K���b��;�&�H5`��x8�p8�H+�`/�@�L8���&Ԁ�&�~�xD�xK���`|xK��8��x8�&T8��H(�`8�&�K��А&&�K��HA��:��8�~��x8�d~óx;�&�H�`~��x��xH!`/�@�$�&�/�@� ��x8�8�H)�`~óx8�&;���HE`{� /�|vx@�8�&&T;�&�8���x8�H)�`8a&�8�8�H)�`A��d:��~óx8�~��x8�dHA`�&�/�@�&�8X�&&�~óx8�&H�`/�&|vxA�� 8�~��x8�dH�`�&�/�@�&`8�&&�~óx8�&Hy`K���;��8���x8�d~óxH�`肅���xH*�`/�@��~óx8�&8&�&&�:���H%`z� |vx.5K��dK���`K��|:�p��x~�x8�H)�`/�@�&h;�&�~�x��x8�H)�`/�@�&�a�K��-`K�����x8a�8�H(�`K���肅���xH)�`/�A��肅���xH)�`/�@���8~óx8�&�&&�:���HU`�b��z� 8.5;�&�|vx�K���~��x8�8�
        !          8619: H,!`|c�/��a&�@���K���~óx8�&8K���8a&�8�8�H'�`K���~��x8�8�
        !          8620: H+�`|c�/��a&�@���K���:����x~�x8�H(�`/�A���~�x��x8�H'i`K�����xD�x8�H(Q`/�A�����xC�x8�H'5`K��l��x8�8�~��xH&�`:a&T~óx8�~e�x8�dH}`�&&T/�A�(9 /H�&/�A�/�\@���3K���~óx8�&H�`;���{�!|vxA���8�~��x8�d;�&�H`~��x��xHE`/�@�$�&�/�@�&�8�8���xH&`~óx8�&Hm`8��x /�|vxA��H8�~��x8�d~óx:a&�H�`~��x~d�xH�`/�@�<�&�/�A�~c�x8�8�H%�`K��d~c�x8�8�H%�`~óx8�&H�`|vxK��8肅�;�&���xH"�`8�&�8`0&K��&`��x;���H"�`8��|dx��xK���`K��p肅�;�&���xH"U`8�&�8`0K���肆p;�&�;���xH.�`+�@����xH"]`肆�|H.m`��x;���H"=`肆�|H.M`8�&�8`0K��M`��xH"`8��|dx��xK��M`K�����x8�8�H$e`K��l肆(8`0;���K���`K���;�&�肆@;�����xH!q`8�&�8`0K���`��xH!�`8��|dx��xK���`K��D�"�x{��|  �} J})�N� �� @;�&�肆8��x��xH-Y`8�&�8`0       K��Y`��xH!`8��|dx��xK��Y`;���K��Ȁ�����;�&�;���肆���xH-&`8�&�8`0K��&`��xH �`8��|dx��xK��&`K��t;�&�肆;�����xH U`8�&�8`0K���`��xH y`8��|dx��xK���`K��(���肆�;�&�;�����xH,e`8�&�8`0K��e`��xH )`8��|dx��xK��e`K���;�&�肆H;�����xH�`8�&�8`0K��`��xH�`8��|dx��xK��`K���;�&�肆P;�����xHm`8�&�8`0K���`��xH�`8��|dx��xK���`K��@;�&�肆X;�����xH!`8�&�8`0K���`��xHE`8��|dx��xK���`K���;�&�肆`;�����xH�`8�&�8`0K��5`��xH�`8��|dx��xK��5`K���;�&�肆h;�����xH�`8�&�8`0K���`��xH�`8��|dx��xK���`K��\��|肆�;�&�;�����xH*�`8�&�8`0K���`��xH]`8��|dx��xK���`K��;�&�肅�;�����xH�`8�&�8`0K��M`��xH`8��|dx��xK��M`K���;�&�肆0��x��x��xH)�`8�&�8`0K���`��xH�`8��|dx��xK���`;���K��l��xH�`肆�|H)�`K��<��xHy`肆�|H)�`K����xHY`肆�|H)i`K�����xH9`肆�|H)I`K�����xH`肆�|H))`K����
|���������|�#x�&����|x�b�������!�Q;�&�H)�`8���x8�&H1`/�A�&�/�@�&��>�   /�-@�&�     &/�f@�&��     /�@�&��~8�8�H#E`/���|xA�X�b��;�pH))`8`8�8���xK��1`/���A�/���A�Ȉ�p��q��r��s�&t�!u�b� H(�`��xK��a`�b�(H(�`8`��x8�K��q`|c4/�A�&��a&�K��   `��&��b�@x�Fx� xņ"x��"H(y`��/�A�<9 /H``�&/�A�/�\@���$�&/�@�����b�HH(%`�;�&���xH�`��x��x<��8�8�x99 9@K��Y`|}xK�؝`/�A�&@/���A��/���A��8+�@�&�/�A�x�b����x;�H'�`H`�>�       /�-A���b��;���H'y`�b��H'm`�b��H'a`�b��H'U`�b�H'I`�b�H'=`8!���x�&����������|�����N� /���A�&</���@��t��&�肇88a�;�&x� x�Fx�"x��"H&!`K���`�     &/�cA�&/�r@��@�     /�@��48`K�|m`|}xK��l```�Vp�b�P��x|��H&�`�b�XH&u`��x��xK�{�`8!�|}x�&�����x�������|�����N� �b�;���H&-`K����b�p;�H&`+�@�p�b��H&````�b��;�&H%�`K���```�b�0;�&H%�`K���� /�@��48`&K�{m`|}xK��l�"�x{��| �} J})�N� 4$DT�b��H%m`K��t�b��H%]`K��d�b��H%M`K��T�b��H%=`K��D�b��H%-`K��4�b�`��x;�&H%`K����b�h��x;�&H$�`K����b�;���H$�`K����b��;���H$�`K���&�```|���������|�#x|~x�����&8�8������!�;�x��xH`/�@������xH�`8
        !          8621: �&�||yA�p/�&A��;��8�@��x8���xH�`��x��xH�`/�A����x8�@8���xHa`��x��xH�`/�@���b��H#�`8`��8!&��&����������|�����N� ;��8�@��x8���xH�`��x��xH-`/�A���;��8�8�&��xH
`�b� ;�pH#]`8`8�8���xK��e`/���A��/���A����p��q��r��s�&t�!u�b��H#`��xK���`�&|/�@�&4�b��H"�`��x8`8�K�י`|c4/���A���a�K��1`����b�x� x��"x�Fx��"H"�`��x8�8a�Hm`����b�x� x�Fxņ"x��"H"m`�a�K��`K���`<ff`fg|�|c�p|p|cP�&�|c&�|c�K���``K���`/�@��K��`K��Y`/�@����b�H!�`8!&�8`�&����������|�����N� ``��x8�|8�H�`�b��H!�`K���```�b�H!�`8!&�8`���&����������|�����N� ��x8�&H&Y`;���{�!|~xA���8���x8�@H�`��x8�|H�`/�A��8��x8�&H&
`;���{�!|~xA��|8���x8�@HI`��x8��Hy`/�A�����x8�&H�`/�&|~xA��4��x8�8�@H&`��x8�8�
        !          8622: H�`�a�K��```��x8�&Hi`;���{� |~xK��D�b��H M`8`��K��p�b��H 9`8`��K��\�b��H %`8`��K��H&�``,$M� 9 `�/�,A�,/�@�H<``A�0�&/�,/ @���9)&8c&y) �H@A���N� `8`N� ```|ix8`&``�  /�,A�,/�@�H@``A�0�     &/�,/ @���5)&A� 8c&xc K���``N� N� N� ``�|kx/�,A�8/�A�0|ix`9)&|HPx � /�,/ M� @���N� 8`N� ``|���������|�+x�&�!��|�#yA�\9````�#/�,A�,/�@�H�``A���#&/�,/)@���9k&8c&yk �X@A���/�A���/�,A��/�A��|ixH`A� 9)&�HP{� �     /�,/ @���|dx|�3x��xH�`/�A�(88!�|���x�&��������|�N� 8!�;���x�&��������|�N� ;�K���&�```|��A���a��;@��������|�#x;���������|x�&�!���!�A�c;ap/�A��/�A��HA`/�A���"�(��x$�xH�`|~yA��$�x��xH�`�P�4{� +�       A�t��xc�x��x��H�`}!��Ipc�x8�8�
        !          8623: H�`|c�+��A�4�|�/�.A�T;�&/�{� ;�&@��H/�8`��A�8`8!��&�!���A���a��|���������������N� �&K���``��x8�    c�xH`c�x��yH`�K��H&�``|���������|}x|�#x�b�0�&���������!�qH�`�b�8H�`/�@�8낈@;�`���x;�&��x��Hm`��;�A���8!�8`���&����������|�����N� &�``|���������|�#x�&����|x�b�H�����!�qK�{I`肈P�}H
I`/�@�/�A��肈X�}H
)`/�A�L肈`�}H
`/�@����x��xK���`8!��&����������|�����N� ��x��xK��`8!��&����������|�����N� ��x��xK�ߙ`8!��&����������|�����N� �b�hH
`/�@�8낈@;�`���x;�&��x��H�`��;�A���8`��K��4&�`|��&�!���cm`E/�LFA�8!p8`���&|�N� �/�@���c8��T>+�&A��Сc8��T>+�&A����/�&A�$/�@���HI`8!p�&|�N� H�`8!p�&|�N� &�```|�=`E��������|�#x�&�!��akLF;�����XA�$8!���x�&��������|�N� `�;���/�@��Ԡ;���0��T>+�&A����;���0��T>+�&A�����/�&A�8/�@���8�H�`8!��~��x�&��������|�N� 8�H]`8!��~��x�&��������|�N� &�``|�= E�A���a��|�3x�&����a)LF|�#x��������|�;x|�+x�����!�a|x;�����HA�48!���x�&�A���a�����|������������N� `�;���/�@��Ġ;���0��T>+�&A����;���0��T>+�&A�����/�&A�t/�@���H`E�xf�x��P��x��xH1`��x���x��Hi`8!���x�&�A���a�����|������������N� He`E�xf�x��P��x��xH�`8!�����x�&�A�����a��|���������������N� &����,}C|./�&A�L�*9`}*BH ``�       }*Kx})B/�&A� 9k&}k��8@���8`N� `�jN� ```|�}�&�&����.%-������&��|�3x�A���a��|�#x;`��������|�+x|}x�����!��;����!�A����H,```�,;�&�����*A����/�&@���/�A�&�?9��A�0��A(#�x|     ����|�\N�!�A(/�@�����|��#�xH   `��?8�|y|HPx H
        !          8624: Y`��/�A��XA��T��A(#�x;�&��|     ��w�WN�!�A(�,���*@��4``8!��`��&��{c �����&��|��!���A��}�& �a�����}�� �����������N� `�?�{�P{�K���� � ��8}C|./�&A�L�69`}*BH ``�     }*Kx})B/�&A� 9k&}k��8@���8`N� `�jN� ```|��!���A���&�a��|�#x��������;���������|x�!�Q�#(#�>�xH(```;�&�<;�@����A��/�@����>,�^(y)6d}9J{Z6dY��     x     ��A���� /�A����_ ��8;��z��8|�2|�2|P.}_R/�&�A��``�69`}*BH� }*Kx})B/�&A��9k&}k��8@���|0*x�"y+.�y)$})XP�ex� |i+�@|�#}+J}`�})�@���b��H`� �8����`@��x@����_ ���z��8|�2|�2|P.}_R/�&�@��@```|0*�*�@@��\�b�pH�`� K���```�B�xx�d|
        !          8625: �}@R}I�N� ���X&���X���X&&d&P���X���X���X���h���h���X���X���X���X���X���X���X���X���X���X���X���X���X���X���X���X���X���X���X���X���X���X���X���X���X���X&D&8���X&,���X���X���h���X���X���h���h���h���h&���X���X���X���X���X&���h���h���X���X���X���h���hU):�+K��\�+K��T�|��� K��@y)� �+K��4y)"�+K��(�+� K��y �y)��|        �K��y)��+K���``8!��&�!���A���a��|���������������N� &�``|�}�&�&����.%-������&��|�3x�A���a��|�#x;`��������|�+x|}x�����!��;����!�A�� ��H,```�8;�&�����6A����/�&@���/�A�&�?9��A�0��A(#�x|     ��(�|�\N�!�A(/�@�����$|��#�xH   `� �?(8�|y|HPx HY`�(/�A��XA��T��A(#�x;�&��|       ��w�WN�!�A(�8���6@��4``8!��}|{�&�������&��|��!���A��}�& �a�����}�� �����������N� ``�?�{�PK����     `�/�A�,x� �@@�N� `M� �&/�@@���8`N� ``�c/�A�\�}i[x/�A�@�@A�$H4``�/� @A�@��#&8�&/�@����} HP}#�N� �9 K���`|ix```��     9)&�8�&/�@���N� `|ix9`8`� /�M� ``�     &9k&}k�/�@���yc N� ``,%|ix8`M� �I/�A�p�}KSx/�A�T8���x�!A�H�@@�@|��H$``�/�@A� B@@��i&8�&/�@��܈}`XP}c�N� �9`K����|ix/�A�4/�M� |��HB@p�     8���9)&x� �&/�@���/�M� 8���9i&x� 88�&|��H```9k&� }i[xB��N� ```N� |���������|y|�#x�&���������!�q@�,8!���x�&����������|�����N� `/�A�dK��`||x��xK��   `/�|}x@���������@@�0`��x��x��xK��%`/�A���;�&��@A���8!�;���x�&����������|�����N� &�`,%M� 8���x� x� |ix8�&|����9)&B��N� `,%M� 8���|ixx� 8�&|��`�8�&�   9)&B��N� ```�@@�\|*�@A�P/�M� 9%��8���y) |�*9)&|�*})�9 `|H�|I�9)��B��N� ```/�M� 8���|ixx� 8�&|��`�8�&� 9)&B��N� ```,%A�L�#�8���x� �@A�(H@```�#&�&ye �@@� /�9e��@���8`N� ``|`HPN� ```|���������|x|�#x�&�����!�q�c/�@�8HhH�`|}x�~H�`��@�D�&;�&/�A�8�/�@���8!�8|`P�&�����������|�N� �8!��|`P�&�����������|�N� &�```8��+�   8A�8c���"��|c�xcd|       �|xN� ``8��+�M� 8c��|c�N� ```,$|ixA�&@+�$�$@�H&`9)&�$�i/� /       ,�
        !          8626: A���/�
A���A���A���/�@��/�0A��8�
        !          8627: /�A��8``8��9K��T>UJ>+�    +
        !          8628: 9)&9K��|4@�$8��T>+�}@4@�M� 9k��}`4�(L� �$|c)҉i/�|`@���N� `/�@��|/�08�@��p�        &9I&/�x@��h9*&�$�j&K��P```8`N� �     &9I&/�x@��(9*&�$�j&K���8���K���`,$|ixA�&X+�$�$8`@�N� 9)&�$�i/� /       ,�
        !          8629: A���/�
A���A���A���/�-8�A��/�@��/�08�
        !          8630: A�&/�8`A�t8`H�$|c)҉i/�|`A�T8��9K��T>UJ>+�    +
        !          8631: 9)&9K��|4@�$8��T>+�}@4@�A�9k��}`4�(A���/�M� |c�N� ``/�A�,�$�iK��\9)&/��$8�&�i@���K��4�$/�08�@��0�    &9i&/�x@�<9+&�$�k&K��8���+�$8`�$@���N� � &9i&/�xA�9`0K���9+&�$�k&K���`|��!���A���a��������������;������&{� |x�&���!�Q;]�ˆ�WZ&��Y���x�```/�A���>|�8h�H@@�&��~}i[x```� )@@T
        !          8632: 6x�(/�|�3x@�,�I&��yJ��}F3xx�E�I|�3x}F3x��@@�@@�D�        &�Ix��|;xyJE�     }G;x|;x8�}):K���```�@@A�&��@@@�& 8�9 H@`9 ��&�Kx�(��xƃ�|�xyJE�}Jx|�Sx8
        !          8633: }k�X@@�Ј/)T
        !          8634: 6x�(/�@���A����&�I�    &��� ��yC�(y���{�䈉}�;xxxE�x�E�|�;x|x|�3x|�x|�:UJ688�&xG"x�}J;xx��I��&���     ���&�K��x�(xƃ�|�xyJE�}Jx|�Sx8
        !          8635: }k�X@A��8/�@��(c�xK�|&`��@�&|c��|K���}i[xK���{�G"{�a){�����H�h&�(�8!��&�&���!���A��|��a����������������N� �0@@�P8i|�0P��}c�{�G"`�{�{��x�G"x��x������&��}�����K�&K���T>8i`�        K��l#�xK�{`/���|hx�~A�}#��|�<K�� 8`K��8&�```���T>���N� `|�/��&�!������������&��!��A�@�8!p8`���&|�N� /�A���8��H%`8!p�&|�N� &�|�|�+x�&�!��|�#x8���|xx�`Hq`8!p�&|�N� &�```|��&�!��|`x�b��������|x�������&��!��A�8��H9`8!p�&|�N� &�`|�����|x�&�!�q�/�A�&�/�A���#
        !          8636: /�A�/�O@�d�8�PK�y�`8|c�/�A�x/�O@��8�9 &���?8!�|x�&����|�N� ``|H�9)&})�/�@����8�PK�ye`8|c�/�@����?9`}i&�8�9 &��K���``�?|`x9`}i&�K���```�8�p8�&K�x�`8��/�&@��D�&pK��<&�&```�b��K���```K���}�&|��a������|�+x;�&��������|}x�&�&���!���A���������!�Q�$&/�A�&�;@;�;�;!pH08      ��T>+�       A�;Z��}:J}:�`�<&/�A�&�8       ��T>+�)A����b��x�|�}`Z}i�N� ���������������������������������&�����������������������������������������������������������������������������������������������������������&�`��xK��
x` /� A���/�       A���/�
        !          8637: A���/�
A���/�A����;��x9i�{�)�      K���xc /� A���/�   A���/�
        !          8638: A���/�
A���/�A����/�A����=
        !          8639: /�@���9)���=�<&/�@���8!&�8`&�&���&���!��|��A���a��}�& ������}�� ��������N� ``��xK��/�xx A��. A� -�    A��/�
        !          8640: A��/�
A��/�A�x��@�p```�xH }`/�A��}!���x;�&���  pK���xx . A��-�   A�$/�
        !          8641: A�/�
A�/�A���A���}!���pA�H/�
        !          8642: A�@/�
A�8/�A�0�/�A�$�=
        !          8643: /�@�9)���=```#�xK���`/�A���;#�x8�8�8      �� K���`�xK�����xK���/�xi A��/� A�/�       A�/�
        !          8644: A��/  
A��/)A�x�@�p```8     ��T>+A�T}a���x;�&���+pK��mxi /� A��/�   A��/�
        !          8645: A� /  
A�/)A��A���`}a���pA�4/�
A�,/�A�$�/�A��=
        !          8646: /�@�9)���=#�xK��`/�A�T�;#�x8�8�8  �� K��e`�xK���`��xK���/�x` A�P/� |xA�T/�       A�L/�
        !          8647: A�t/�
A�l/�A�d��@�\``}!���x;�&���  pK��Mx` /� |xA�&�/�       A�&�/�
        !          8648: A�/�
A�/�A���A���}!�/�
        !          8649: ��pA�4/�
A�,/�A�$�/�A��=
        !          8650: /�@�9)���=�;$�x8      ��iK��=`K�����xK���/�xx A��. A�0-�   A��/�
        !          8651: A��/�
A��/�A�x��@�p```�xK��-`/�A�h}!���x;�&���  pK��9xx . A��-�   A�$/�
        !          8652: A�/�
A�/�A���A���}!���pA�H/�
        !          8653: A�@/�
A�8/�A�0�/�A�$�=
        !          8654: /�@�9)���=```#�xK��m`/�A�&�;#�x8�8�
        !          8655: 8      �� K��!`�xK���}!���x;�&���     pK��]x` /� @�```}!�$�x��p�;8 ��iK��`K��,``/� A�```/�       A�P/�
        !          8656: A���/  
A���/)A���8 ��T>+A���}a���x;�&���+pK���xi /� @���}!�#�x��pK��a`/�@���8!&�8`�&���&���!��|��A���a��}�& ������}�� ��������N� . A�d``-�       A���/�
        !          8657: A���/�
A���/�A����xH�`/�A�&}!���x;�&���      pK���xx . @���}!���pK���```. A�d``-�   A���/�
        !          8658: A���/�
A���/�A����xK��m`/�A��}!���x;�&���      pK��yxx . @���}!���pK���```/� A��``/�   A���/�
        !          8659: A�$/�
A�,/�@���9`K��``9`
        !          8660: K���``9`
K���}!���pA���K���}!���pA��0K����```}�&|��a���A��|{x��������;��&�����������!�1��&�x!A�&`;�p;�;A&H ```�&8�&x!A�&4/�%|�#x@���x ��x�      ;�&9)&|�P|
        !          8661: ��-s/�d}&U@-%/i,�x,X.p-�c�&�}&U@-O�&�}&U@-o�&�A��A�&A�&A�&A�&(A�&4�&�U >} U�>A�&0�&�U >} U�>A� �&�U >} U�>A�&@��H9`o9*&}AR})�}!J�jp��p�/�%A���c�x��xE�xK���/�@�$�&;�&8�&��x!@���``8!���x�&���A���a��|�������}�& ��������}�& }�� N� `9`dK��```9`iK��P``9`xK��@``9`XK��0``9`pK�� ``9`cK��``9`sK��``9`OK����```xc 9#��8��(�+  8c��L�(BOY�B+�O��B} &U#?�U)��|&T��|cKx|cx|c�N� ``|���������|�+x|~x�&����|�#x8�&@�!�1;�p��xH�`��x|}x�~{� K�k�`8!&���x�&�����������|�N� &�`|��"������|�#x�&����8��|�+x��������T>|x�!�a+�
�I�)8�!p�AxA�X� @@�|�"���       /�A���c8-�8�c9k&�c� ��8&�=p�+�?9)&�?8!�|x�&����������|�����N� ``�+������x��PK��!���?8!�8&|x�}p�i�&�?������|�9)&�����?����N� ``�cK��T&�```|��a������}Cx|�;x�&����|�3x��������|~x|�+x�!�a|�#x8�
        !          8662: 8�K��!`/�9 8&|c�A� `��9)&/�})�@���y  |�|��@�@|P|�/�@�0x �>|  �```���>9)&�>B��8!�8`�&�a��������|���������N� &�``|����p���x9�x9�0�&�&��:&��������:� �����&��|�#x|xx�!���A��; �a�������!���A���a�������������������!��;a&P;Ap:���{1�%/�A�8|P��@�,/�%A���#8�&�a&�8c&�a&��%/�@���8��a&�8!&P|xP�&���p|c����x�&��|��!���A���a�����������������&���!���A���a����������������N� `K�x|�+x8%�;�&|�P|
        !          8663: ��/�dA��/�iA��/�uA��/�xA��/�XA��/�pA��/�cA��/�sA��/�%A�/�OA��/�o9k&@���9 o9j&}AR}k�}aZ�*p�+p�/�%@� 9#&��!&�8�&�a&�K���`�&q��:&/�0A�/�.:` ;�qA��</�A�P|�:��&�;�8        ��T>+�)@�D8 ��T>+�       A�}z�;�&{� �+�<&/�@���~&�xK��p```�b��x�|�}`Z}i�N� X������������������������������������������������������������������������&������������������������X��������X&h������������������������8�8�
        !          8664: ~��x�?K��
`x ��xK��}`�@@�D|c�Pxc!A�8/��!&�|i�A��A��```���!&�9)&�!&�B��;�H(`�!&�|��;�&{� �  �!&�8 &�&&���xK���`��@A���K��l``}:�~��x��x8�8� 9�)c�xK����!&�c�x��x8����!&�8     &�&&���&�!&�8 &�&&�K��]�<&K��}:�c�x~��x8�&8�
        !          8665: 8� �)9K����!&����a&��<&8c&�a&�K���}:��b��z�$8�~g�x}k9�)~��xc�x�KҐ8~E�xK��-c�x~D�x8�K��͍<&K��x}:��b��z�$8�~g�x}k9�)~��xc�x�KҐ8~E�xK���c�x~D�x8�K��}�<&K��(�<&:�/�h@���<&:�&K��`V�88      ��}:�~6��x�)�9A�4�a&��"��z�$})8-��I�!&��a�8 &}r�8�&&�~E�x8�
        !          8666: ~g�x9~��xc�xK��9c�x~D�x8�
        !          8667: K��ٍ<&K���```�<&:�/�l@��hK��````:`0;�rK���`9 dK���``9 iK��|``9 uK��l9 xK��d9 XK��\9 pK��T9 cK��L9 sK��D9 OK��<8&|  �K�� &��x�����No net_xmit function availableCan not open "%s" because file descriptor list is full
        !          8668: No net_ioctl function availableNo net_init function availableNo net_receive function availableELF loading failed!
        !          8669: net_e1000net_bcmnet_vethnet_virtio``/rtas
        !          8670: Could not open /rtas
        !          8671: rtas-size
        !          8672: Size of rtas (%x) too small to make sense
        !          8673: 
        !          8674: Failed to allocated memory for RTAS
        !          8675: Could not open /rtas
        !          8676: instantiate-rtasinstantiate-rtas failed
        !          8677: read-pci-configibm,read-pci-configwrite-pci-configibm,write-pci-configibm,update-flash-64-and-rebootibm,update-flash-64ibm,manage-flash-imagesystem-rebootget-time-of-dayset-time-of-daystart-cpustop-selfTOK
        !          8678: start-cpu called %d %x %x %x
        !          8679: bootmsg-warningbootmsg-errorreleasepeeryieldcall-methodgetpropregassigned-addressescloseinterpretibm,romfs-lookupset-callbackopenfinddevice/chosen/aliasesnetbootpathlocal-mac-addressparentname#address-cells#size-cellsrangescompatibleIBM,vdeviceibm,virtiovendor-iddevice-idrevision-idclass-codeinterruptschildtestdma-map-outdma-map-inset-ledwrite-mm-logreadwritertas-write-vpdrtas-read-vpdclaimstdinstdout  No net device found 
        !          8680: /cpustimebase-frequencyseekclient-interface module initialized!
        !          8681: my-parent``������������`:////@/:
        !          8682: ERROR:                 Bad URL!
        !          8683: 
        !          8684: ERROR:                 Bad host name!
        !          8685: 
        !          8686: ERROR:                 Can't resolve domain name (DNS server is not presented)!
        !          8687: 
        !          8688: Giving up after %d DNS requests
        !          8689: bla   %02d
        !          8690: Giving up after %d bootp requests
        !          8691: .    %03d
        !          8692: Aborted
        !          8693: 
        !          8694: Giving up after %d DHCP requests
        !          8695: %d KBytesblksizeoctet%d  Receiving data:  
        !          8696: Repeating TFTP read request...
        !          8697: Lost ACK packets: %d
        !          8698:  Bootloader 1.6 
        !          8699: E3000: (net) Could not read MAC address  Reading MAC address from device: %02x:%02x:%02x:%02x:%02x:%02x
        !          8700: E3006: (net) Could not initialize network devicebootpdhcpipv6  Requesting IP address via BOOTP:   Requesting IP address via DHCP: E3001: (net) Could not get IP address%d.%d.%d.%d
        !          8701: E3002: (net) ARP request to TFTP server (%d.%d.%d.%d) failedE3008: (net) Can't obtain TFTP server IP address  Requesting file "%s" via TFTP from %d.%d.%d.%d
        !          8702:   TFTP: Received %s (%d KBytes)
        !          8703: (net) unknown TFTP errorE3004: (net) TFTP buffer of %d bytes is too small for %sE3009: (net) file not found: %sE3010: (net) TFTP access violationE3011: (net) illegal TFTP operationE3012: (net) unknown TFTP transfer IDE3013: (net) no such TFTP userE3017: (net) TFTP blocksize negotiation failedE3018: (net) file exceeds maximum TFTP transfer sizeE3005: (net) ICMP ERROR "net unreachablehost unreachableprotocol unreachableport unreachablefragmentation needed and DF setsource route failedE3014: (net) TFTP error occurred after %d bad packets receivedE3015: (net) TFTP error occurred after missing %d responsesE3016: (net) TFTP error missing block %d, expected block was %d
        !          8704:  Flasher 1.4 
        !          8705:    Bad buffer address. Exiting...
        !          8706:    Usage: netflash [options] [<filename>]
        !          8707:    Options:
        !          8708:             -f     <filename> flash temporary image
        !          8709:             -c     commit temporary image
        !          8710:             -r     reject temporary image
        !          8711:    Bad arguments. Exiting...
        !          8712: 
        !          8713: 
        !          8714: E3000: Could not read MAC address
        !          8715: 
        !          8716: E3006: Could not initialize network device
        !          8717: %02x:%02x:%02x:%02x:%02x:%02x
        !          8718: 
        !          8719:   DHCP: Could not get ip address
        !          8720: 
        !          8721:   ARP request to TFTP server (%d.%d.%d.%d) failed  Requesting file "%s" via TFTP
        !          8722:   Now flashing:
        !          8723:   Tftp: Could not load file %s
        !          8724:   Tftp: Buffer to small for %s
        !          8725: 
        !          8726:   ICMP ERROR: Destination unreachable:  UNKNOWN: rc = %d!  Reading MAC address from device: 
        !          8727: ping device-path:[device-args,]server-ip,[client-ip],[gateway-ip][,timeout]
        !          8728:   Own IP address:   Ping to %d.%d.%d.%d success
        !          8729: failed
        !          8730: 
        !          8731:   Reading MAC address from device: No such callback function
        !          8732: argv[%d] %s
        !          8733: netbootnetflashpingUnknown client application called
        !          8734: ``
        !          8735: ELF relocation out of bounds!
        !          8736: ERROR: Unhandled relocation (A) type %i
        !          8737: &&&&&&&&&&0123456789ABCDEF������������������������������������&&��&`&��&���&��&���&���&��`&��`&���&���&��
 &��
P&��
�&��p&���&��p&���&���&���&���&���&��&��0&��<&��&��`&���&���&�� &���&�� &���&���&���&��@&���&��&���&���&���&���&���&�� &�� 0&�� �&��!`&��!�&��" &��"�&��#&��#�&��$�&��%�&��& &��&p&��'&��'�&��(P&��(�&��)p&��)�&��*�&��+P&��+�&��/0&��/p&��0`&��2�&��3&��3�&��40&��4�&��5�&��6�&��6�&��7p&��7�&��8`&��9&��9�&��;�&��<P&��= &��=�&��>&��>P&��?P&��?�&��?�&��?�&��@@&��@�&��A0&��A\&��Ap&��A�&��B&��B &��B@&��B`&��B�&��B�&��B�&��C0&��Cp&��C�&��C�&��D&��D &��D@&��D`&��D�&��E&��E�&��G&��G &��G@&��G`&��G�&��G�&��G�&��H�&��H�&��H�&��I&��I�&��Jp&��L�&��S0&��T`&��V�&��Y@&��Yp&��Y�&��Z�&��Z�&��Z�&��Z�&��\`&��^�&��_�&��dp&��ep&��g�&��h�&��i�&��l&��o�&��q�&��x@&��y�&��z�&��|@&���&���&����&����&����&����&����&����&����&����&���&����&����&��� &����&���`&����&����&����&���@&����&����&���&����&����&����&���`&����&����&����&���0&��� &���`&����&���`&����&����&����&��� &����&���0&��Ơ&����&���0&��ǀ&����&���@&���`&���p&��� &��Ր&����&���p&����&����&��``````````````````````````````````````````````&�����&��&�&x&&���������(�H�x&&&&�X�p�8������&&�����8� �&^������c�Sc&������`&2�P&&2�P````````````````````````````````````�!���&0|��&8|��&H|��&P�a@8�``H-A�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8�``H,A�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8��`�H+��&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8�``H+A�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8��`�H*��&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8�``H*A�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8�``H)A�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8�``H(A�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8�``H'A�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8 �`     `H&A�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8
        !          8738: �`
        !          8739: `H%A�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8�``H$A�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!��}h��a0}z��a@}{��aH�b��k}i�|
        !          8740: xN�!�a0}h��a@}z��aH}{�8!PL$�!���&0|��&8|��&H|��&P�a@8
�`
`H"A�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8�``H!A�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8�``H A�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8�``HA�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8�``HA�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8�``HA�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8�``HA�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8�``HA�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8�``HA�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8�``HA�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8�``HA�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8�``HA�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8�``HA�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8�``HA�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8�``HA�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8�``HA�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8�``HA�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8�``HA�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8�``HA�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8 �` `HA�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8!�`!`HA�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8"�`"`H
A�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8#�`#`HA�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8$�`$`HA�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8%�`%`H
        !          8741: A�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8&�`&`H        A�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8'�`'`HA�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8(�`(`HA�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8)�`)`HA�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8*�`*`HA�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8+�`+`HA�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8,�`,`HA�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8-�`-`HA�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8.�`.`H&A�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���&0|��&8|��&H|��&P�a@8/�`/`HA�&H|��&P|��&8|��&0�a@8!XL$``&`N� �!���A@�aH��P��X��`��h�&p�!x�A��a��������������&��!��A��a��������������&��!��A&�a&��&��&��& ��&(}����&0}i�<``cxc�dc`c��C�b��#}��N�!}����&0}���A@�aH�P�X��`��h�&p�!x�A������������&��!��A��a������������&��!��A&�a&�&�&��& ��&(8!&0N� &7�& &@���&&2�Q����ߠ���������8��Cނ׶4� ě��S�����P���&�&�`�`�x&8��&��&�����X���&�������8�P�h�����������0�@�P�`�p����&8�����0������������� �0�H�X�������`�p�x����������������� �0�@�P�`�p�x���������������������� �(�����@�(�X�@�@&�&�H���p&���8�� ě��S��1�@�&�1�82���&��1�T2� �2�(������������@�h2� �p�x��&�2�(����������2�8&��2�� ��(�0�H��p�8�������H�P�X&�`�������(�`������ �@�h������@�D�`�p������X���0�p�������(�`�������8��X�����������8���`�p�������h������8��X������(�8�@���h�������������02�&0&�$�X2�P�XGCC: (GNU) 4.4.5.symtab.strtab.shstrtab.rela.client.rela.lowmem.rela.got.comment.branch_lt.bss &&�&&Z�0&-&& &�.�&(&�H�:&&7�&7(�5&�@?&0&@p&?�&&H&&@�&@S&@�&?�1��&@X&&&C�`
        !          8742:     &S&&&&7�     &@�&&&� &&`&  &@p&@�3&�hI&�(|Q&���X&&�<_&�8o&�(u&��`�&&@\�&&(D�&<�        &���&��8�&��h�&&�t�&���&��D�&���&&8��&�0&&�@�&&  &         ��&)&0&0&� �&;&�H�&I&�P|&W&�`�&_&& D&f&&��&k&�P&|&�@�&�&���&�&&�d&�&�P�&�&�P&d&�&&0�&�&�Hp&�&�x�&�&�x�&�&�|&�(X&&�&\&��'&�`�8&��TD&�@8K ��PW&&8Xa&��l 2�Qy&&&�&�� ���&�X��&7��&���&�p8�&��&���&&�X�&& �&���&&�&�&�&&�(&�$*&��3&�x�B&���J&��P&��@b&���k&& ${&��P�&���&����&����&�(��&&��&��L�&�L�&&���&���&&���&&���&��t&&��&���&&h� &&��%&&&x4 ��:&&PtA&�|J&��Q&�X&&&X&�`&&&8u&� |}&��l�&&&��&&H&��&&�D� 2��&&<�&&&�&l�&&p�&����&&&�t�&&4� ��&&x|&&"&&p*&��:&�0&@&��&4R&�0@]&&&@&4e&�pt&�\�&&0 �&�&&�8�&A0�&����&� �&����&�p��&7��&&&p�&��&��&0&�X#&��H.&��|8&&�H?&��D&��M&&�$U&�0Hh&��h�&A\�&&`H�&&t�&&0�� ��X�&�l�&���&�8��&��&�`&x�&&�|&&�
&�._start_kernel.callback_entry.exception_forwardcall_client_interfaceof_testmdelaystrcpyset_ipv4_routerioctltranslate_address_devprintfvsprintf.undo_exception_prom_entryrecvhandle_arpget_arg_ptrset_timersend_ipv4get_sec_ticksmemmoveglue_inithandle_udp_lowmem_startfd_array._exitrtas_tokenrmmod_by_typeof_finddeviceread_iomemcpypingset_ipv4_addressrtas_pci_config_readromfs_lookupmalloccimod_check_and_installrtas_callvsnprintfset_mac_addressof_getpropwrite_ioof_set_callbackhandle_udp_dunstrtoulhandle_dnsof_call_method_3handle_ipv4socketsnk_modulesof_moduleof_release__client_endelf_load_file_to_addrtb_freq_system_call_lowmem_end_callback_entrysendget_mac_addressget_timerisxdigitstdin_datapong_ipv4strtolmodules_initglue_releasefill_udphdrof_claiminsmod_by_typeget_macwritetranslate_addressof_writehandle_tftp_dunrtas_ibm_manage_flashmodules_termof_readget_puidrtas_pci_config_writenetflashhandle_dhcp_startstrstrreadnetbootstrncmpof_closestrncpyudelaystrcasecmptftpget_args_count_rtasmemcmpof_childprintk_entrystrtoipsnk_kernel_interfaceof_opensbrkelf_load_segments32elf_load_segments64handle_tftpsend_ipmemsetmaingetchardns_get_ipelf_get_base_addr32dhcpexception_stack_framestrcmp__client_startsprintfrtas_call_entrybootpdhcp_send_releasesend_etherargncpyhandle_tcp_dunmalloc_alignedstdout_data._callback_entryisdigit.call_client_interfaceof_interpret_1set_ipv4_netmaskbootmsg_errorwrite_mm_log_gotcallback_exitping_ipv4handle_tcpfill_iphdrof_parentstrlenopendns_inittoupperget_module_by_typertas_ibm_update_flash_64.rtas_call_entrystrchrelf_get_base_addr64elf_relocate64rtas_argsfill_ethhdrundo_exceptionrtas_initclosereceive_ethervfprintffree._entry& *
        !          8743: &j/&z/&~?&�%
        !          8744: &��
        !          8745: B?j/$n/4z?(�
        !          8746: �?8�?�/�?�%
        !          8747: �%
        !          8748: $H
        !          8749: 4Y
        !          8750: @S
        !          8751: T%
        !          8752: �I
        !          8753: z?@@
        !          8754: X&
        !          8755: ����
        !          8756: ��
        !          8757: B?HDg
        !          8758: �?P<�
        !          8759: t%
        !          8760: �?@&
        !          8761: ��"?@f?X ?@ �?` �g
        !          8762:  �&
        !          8763: �@ ��
        !          8764: 
        !          8765: J?@
        !          8766: �?x
        !          8767: �g
        !          8768: 
        !          8769: ��
        !          8770: 2?p4g
        !          8771: B?hDg
        !          8772: �*
        !          8773: �%
        !          8774: �&
        !          8775: �p��
        !          8776: �&
        !          8777: �p�r
        !          8778: 
n?�
r?�
�?�?��?�v?��?��?��x
        !          8779: �?�&?��)
        !          8780: 
        !          8781: ?�?�<
        !          8782: .?�2?�j?��M
        !          8783: �?�&
        !          8784: �`V?��?��?��?��?��?��?��&
        !          8785: �``+
        !          8786: ��,��,?��?��?��
        !          8787: 
        !          8788: 2?�>?��P&&�x�`&&߈�p&&ߐ߀&&ߠ&g&&`&&&&0*&&8�&&@�&&Hx&&Pr&&��&&��&&[&&N&&&&"&& L&�&&�3��&&`��3��&&&��3��&&��3�&&�3�(&&��03�@&&��H3�X&&`�`3�p&&
        !          8789: `�x3�&&��3�&&��3�&& ��3��&&P��3��&&���3�&&
p�3�&&
�� 3�0&&p�83�H&&��P3�`&&��h3�x&&��3�&&��3��&�3���&��3�� &��3��&��3?& #
        !          8790: *?&:?&0D/
        !          8791: `�
        !          8792: tk
        !          8793: �?&P�5
        !          8794: �?& �?&(?& ?&82?& 6?&H>?& B?&@J?& N?&Xj?&�/
        !          8795: �&
        !          8796: ��&
        !          8797: ��?&`!
        !          8798: ?&h?&p!
        !          8799: ?&x!
        !          8800: &?&�(!
        !          8801: 2?&�4!
        !          8802: >?&�@!
        !          8803: J?&�L!
        !          8804: V?&�X!
        !          8805: b?&�d!
        !          8806: n?&�p!
        !          8807: z?&�|!
        !          8808: �?&��!
        !          8809: �?&�~?&�{
        !          8810: �?&�{
        !          8811: "?&hH,
        !          8812: N?&�Pg
        !          8813: �?&h�,
        !          8814: �?&��g
        !          8815: &?&h�,
        !          8816: �?&h,
        !          8817: �?&h�,
        !          8818: �?&h,
        !          8819: F?&hl,
        !          8820: �?&h�,
        !          8821: ?&hX,
        !          8822: �,
        !          8823: �?&h(,
        !          8824: l,
        !          8825: �?&��?&� hq
        !          8826:  r?&� �
        !          8827: 
        !          8828: !q
        !          8829: !
        !          8830: ?&�!$
        !          8831: 
        !          8832: !�q
        !          8833: !�?&�!�
        !          8834: 
        !          8835: !�?":
        !          8836: "Hq
        !          8837: "Z?"l
        !          8838: 
        !          8839: "�q
        !          8840: "�?"�
        !          8841: 
        !          8842: #Hq
        !          8843: #R?#x
        !          8844: 
        !          8845: $q
        !          8846: $? $D
        !          8847: 
        !          8848: $�?0$�/
        !          8849: %�?(%�q
        !          8850: %�?8%�
        !          8851: 
        !          8852: &H^
        !          8853: &�q
        !          8854: &�?@&�
        !          8855: 
        !          8856: '4�
        !          8857: 'Pq
        !          8858: 'Z?H'|
        !          8859: 
        !          8860: '�q
        !          8861: (
        !          8862: ?P(
        !          8863: 
        !          8864: (xq
        !          8865: (�?X(�
        !          8866: 
        !          8867: (�k
        !          8868: (�?)?p)&?`)*?h)�q
        !          8869: )�?x)�
        !          8870: 
        !          8871: )�?�*#
        !          8872: *?�* /
        !          8873: *(#
        !          8874: *R?�*T#
        !          8875: *j?�*t/
        !          8876: *�&
        !          8877: �h*�?�*�/
        !          8878: *�%
        !          8879: +%
        !          8880: +xq
        !          8881: +�?�+�
        !          8882: 
        !          8883: ,?�,,/
        !          8884: ,<&
        !          8885: ��,T�
        !          8886: ,l�
        !          8887: ,�?�,�/
        !          8888: ,�?�,�/
        !          8889: ,�/
        !          8890: ,�?�,�/
        !          8891: .`/
        !          8892: .x/
        !          8893: .��
        !          8894: /&
        !          8895: ��/D&
        !          8896: �h/`
        !          8897: /��
        !          8898: /�?(/��
        !          8899: /�/
        !          8900: 0
        !          8901: 0�&
        !          8902: �h0��
        !          8903: 0�?�0�/
        !          8904: 0�?�0�x
        !          8905: 0�?�0�]
        !          8906: 0�?(0�/
        !          8907: 1/
        !          8908: 1F?�1`/
        !          8909: 1f?�1t/
        !          8910: 1z?�1�/
        !          8911: 1�?1�/
        !          8912: 1�?1�/
        !          8913: 1�?01�/
        !          8914: 2DU
        !          8915: 2�q
        !          8916: 2�?2�
        !          8917: 
        !          8918: 3(q
        !          8919: 3:?3L
        !          8920: 
        !          8921: 3�? 3�
        !          8922: 3�q
        !          8923: 3�
        !          8924: 
        !          8925: 4^?(4d
        !          8926: 4�q
        !          8927: 4�
        !          8928: 
        !          8929: 58q
        !          8930: 5B?05\
        !          8931: 
        !          8932: 5pq
        !          8933: 5z?85�
        !          8934: 
        !          8935: 6q
        !          8936: 6"?@6H
        !          8937: 
        !          8938: 6�T
        !          8939: 7q
        !          8940: 7?H78
        !          8941: 
        !          8942: 7�P
        !          8943: 7�q
        !          8944: 8?P8(
        !          8945: 
        !          8946: 8�q
        !          8947: 8�?X8�
        !          8948: 
        !          8949: 98q
        !          8950: 9B?`9h
        !          8951: 
        !          8952: 9�?�9�#
        !          8953: 9�?:R?h:V?`:b?h:f?p:r?p:�/
        !          8954: :�?x:�/
        !          8955: :�?�:�P
        !          8956: :�&
        !          8957: ��:�?�:�#
        !          8958: ;f
        !          8959: ;?�;/
        !          8960: ;�
        !          8961: ;&?�;*?�;2?�;6?�;:?�;>?�;`K
        !          8962: ;v?�;�q
        !          8963: ;�?�<
        !          8964: 
        !          8965: =�V
        !          8966: >$(
        !          8967: >�(
        !          8968: >�V
        !          8969: >�(
        !          8970: ?V
        !          8971: ?V?�?Z?�?j?�?�?�?�?�@P
        !          8972: @F?�@`T
        !          8973: @�?�@��
        !          8974: @�?�@�T
        !          8975: AP
        !          8976: A?�A2?&P&&�X&X&&�p&h&&�8&p&&�&x&&��&�&&��&�&&��&�&&��&�&&�8&�&&� &�&&��&&�3� &&`�(3�8&&��@3�P&&��X3�h&& �p3�&&��3��&& ��3��&&���3��&&���3��&&���3��&&@�3�&&��3�(&&�03�@&&��H3�X&&��`3�p&&��x3��&&���3��&&���3��&&��3��&&0��3��&&���3�&& `�3�&& �� 3�0&&! �83�H&&!��P3�`&&"�h3�x&&"���3��&&#���3��&&$���3��&&% ��3��&&%p��3��&&&��3�&&&��3� &&'P�(3�8&&'��@3�P&&(p�X3�h&&(��p3��&&)���3��&&*P��3��&&*���3��&&.0��3��&&.p��3��&&/`�3�&&1��3�(&&2�03�@&&2��H3�X&&30�`3�p&&3��x3��&&4���3��&&5���3��&&5���3��&&6p��3��&&6���3�&&7`�3�&&8� 3�0&&8��83�H&&:��P3�`&&;P�h3�x&&< ��3��&&<���3��&&=��3��&&=P��3��&&>P��3��&&>���3�&&>��3� &&>��(3�8&&?@�@3�P&&?��X3�h�&�p3���&��3Ar?C�?C�?C�?��&&@p��3��&&@���3��&&A��3��&&A ��3��&&A@�3�&&A`�3�(&&A��03�@&&A��H3�X&&A��`3�p&&B0�x3��&&Bp��3��&&B���3��&&B���3��&&C��3��&&C ��3DB? D�%
        !          8977: D�%
        !          8978: D�A
        !          8979: E&? E,%
        !          8980: ER? E\q
        !          8981: E�? E�q
        !          8982: E�
        !          8983: F"?(F,e
        !          8984: F>?0FHe
        !          8985: Fde
        !          8986: F�
        !          8987: F�6
        !          8988: F�e
        !          8989: G?8G"?8GB?8Gb?8G�?8G�?8H`q
        !          8990: Hz?@H~?HH�?8H�&
        !          8991: �H�?8H�&
        !          8992: �H�?8H�&
        !          8993: �I2?PI6?8I�?8I�?PI�q
        !          8994: J%
        !          8995: J4%
        !          8996: J�?8KB
        !          8997: K e
        !          8998: K|q
        !          8999: K�B
        !          9000: K��
        !          9001: K�B
        !          9002: K�&
        !          9003: ��K�~
        !          9004: LV?XLhe
        !          9005: L�%
        !          9006: L�%
        !          9007: L�~
        !          9008: MF?8N�?XN�?`N�q
        !          9009: N�B
        !          9010: N�&
        !          9011: ��N�B
        !          9012: N��
        !          9013: O~
        !          9014: Ob?8O�?XO�B
        !          9015: O��
        !          9016: O�%
        !          9017: O�~
        !          9018: P�?XQe
        !          9019: Q6?PQb?8Q�q
        !          9020: R�q
        !          9021: R�B
        !          9022: R��
        !          9023: R�%
        !          9024: S?XS2?8S�q
        !          9025: T8
        !          9026: U�%
        !          9027: U�
        !          9028: Vd2
        !          9029: V��
        !          9030: V�?8W?8X%
        !          9031: X�%
        !          9032: X�&
        !          9033: ��Y
        !          9034: Y�
        !          9035: Y�Q
        !          9036: Z8X
        !          9037: ZPo
        !          9038: Zx4
        !          9039: Z�?h[l%
        !          9040: \?p\

        !          9041: \�?x]0&
        !          9042: ��]R?h]~?h]�&
        !          9043: ��]�x
        !          9044: ^(x
        !          9045: ^L&
        !          9046: ��^��
        !          9047: ^�?h^�q
        !          9048: _

        !          9049: _�
        !          9050: _LJ
        !          9051: _l�
        !          9052: _|
        !          9053: `?p`?h`

        !          9054: `"?�`(Z
        !          9055: `:?�`@Z
        !          9056: `N?�`XZ
        !          9057: `pZ
        !          9058: `~?�`�Z
        !          9059: `�Z
        !          9060: `�?�`�Z
        !          9061: `�Z
        !          9062: a?�a
        !          9063: a`_
        !          9064: a|

        !          9065: a��
        !          9066: a�_
        !          9067: b

        !          9068: b&?�b(
        !          9069: bt�
        !          9070: b~?�b�Z
        !          9071: b��
        !          9072: b�

        !          9073: b��
        !          9074: c&
        !          9075: ��c
        !          9076: c
        !          9077: c0�
        !          9078: cPC
        !          9079: cr?�cx
        !          9080: c�&
        !          9081: ��c�?�c�
        !          9082: d�q
        !          9083: d��
        !          9084: d�J
        !          9085: d�?�e

        !          9086: eB
        !          9087: e$%
        !          9088: e4
        !          9089: e�q
        !          9090: e�
        !          9091: e�
        !          9092: f
        !          9093: f�B
        !          9094: f�e
        !          9095: f�?�f�%
        !          9096: f�

        !          9097: g C
        !          9098: g�?�g�
        !          9099: g�?�g�?�g�
        !          9100: g�&
        !          9101: �g�&
        !          9102: �h?�h
        !          9103: hB?�hH
        !          9104: h�%
        !          9105: i%
        !          9106: i4%
        !          9107: kL%
        !          9108: k�&
        !          9109: �HlHq
        !          9110: lR?�l\e
        !          9111: n8%
        !          9112: n�%
        !          9113: o�?�o�%
        !          9114: qX�
        !          9115: qt%
        !          9116: q��
        !          9117: q�%
        !          9118: r0q
        !          9119: r�?r�%
        !          9120: r�?�r�e
        !          9121: r��
        !          9122: s_
        !          9123: s(�
        !          9124: sD_
        !          9125: s�%
        !          9126: s�&
        !          9127: �xt�
        !          9128: t$�
        !          9129: tH'
        !          9130: t��
        !          9131: t�_
        !          9132: t�_
        !          9133: u8q
        !          9134: uTB
        !          9135: uh%
        !          9136: u|q
        !          9137: u�%
        !          9138: u�%
        !          9139: u�&
        !          9140: ��u�J
        !          9141: v�
        !          9142: v
        !          9143: vT%
        !          9144: v�&
        !          9145: �`v�&
        !          9146: �xv�
        !          9147: v��
        !          9148: w

        !          9149: w

        !          9150: wH&
        !          9151: �`wd&
        !          9152: �`w|&
        !          9153: �`w�?w�

        !          9154: w��
        !          9155: w�_
        !          9156: w�?w�

        !          9157: x _
        !          9158: xn?x|q
        !          9159: x�?x�

        !          9160: x�B
        !          9161: x�%
        !          9162: x�q
        !          9163: x�&
        !          9164: ��yJ
        !          9165: y,�
        !          9166: y<
        !          9167: y�?y�q
        !          9168: y�B
        !          9169: y�%
        !          9170: y�q
        !          9171: z$&
        !          9172: ��z8J
        !          9173: zX�
        !          9174: zh
        !          9175: z�?z��
        !          9176: {?{Z
        !          9177: {0Z
        !          9178: {L_
        !          9179: {pG
        !          9180: {�

        !          9181: |�
        !          9182: |�?|�?|�

        !          9183: |�

        !          9184: |�?|�
        !          9185: |�? |�
        !          9186: |�s
        !          9187: }&
        !          9188: ��} 
        !          9189: }(
        !          9190: }0�
        !          9191: }LC
        !          9192: }|
        !          9193: }�s
        !          9194: }�?(}�
        !          9195: }�?8}�
        !          9196: ~,�
        !          9197: ~D&
        !          9198: ��~h

        !          9199: ~�

        !          9200: ~�t
        !          9201: ?0
        !          9202: �?@�?@�?H�?P�
        !          9203: �R?P�hz
        !          9204: ��
        !          9205: ��?H�q
        !          9206: �"?@�HJ
        !          9207: �Z?X���
        !          9208: �6?`�Pq
        !          9209: �Z?@�j?h���
        !          9210: ���
        !          9211: ���
        !          9212: ���
        !          9213: ��J
        !          9214: ��
        !          9215: �%
        !          9216: �(�
        !          9217: �@�
        !          9218: �X%
        !          9219: �d�
        !          9220: �|�
        !          9221: ��%
        !          9222: ���
        !          9223: ���
        !          9224: ��%
        !          9225: ��?X�d�
        !          9226: �t�
        !          9227: �~?h���
        !          9228: ���
        !          9229: ���
        !          9230: ��?@�Z?p�dz
        !          9231: �n?x�p
        !          9232: ��&
        !          9233: �8��
        !          9234: ��
        !          9235: ��&
        !          9236: �h���
        !          9237: ��C
        !          9238: ��?H�&
        !          9239: �P�b?H�x
        !          9240: ��
        !          9241: ���
        !          9242: ��?���
        !          9243: ��&
        !          9244: �h�,&
        !          9245: �8�2?��4
        !          9246: �r?��t
        !          9247: ��?@��&
        !          9248: �8��
        !          9249: ��
        !          9250: ��?H�V?h�h�
        !          9251: ���
        !          9252: ���
        !          9253: ��e
        !          9254: ���
        !          9255: ��3
        !          9256: �&
        !          9257: �P�"?��|q
        !          9258: ��J
        !          9259: ��?X�&
        !          9260: �P��%
        !          9261: �&
        !          9262: �P�X&
        !          9263: �P���
        !          9264: �@G
        !          9265: �`G
        !          9266: �xG
        !          9267: ��G
        !          9268: ��G
        !          9269: ��?���
        !          9270: ��?���
        !          9271: ��q
        !          9272: ��7
        !          9273: �s
        !          9274: �0
        !          9275: �8
        !          9276: �@C
        !          9277: �`7
        !          9278: ��?���
        !          9279: ��.
        !          9280: ��c
        !          9281: ��?��$%
        !          9282: �b?�t
        !          9283: ��?��
        !          9284: ��b
        !          9285: ��?���
        !          9286: ��v
        !          9287: ��?�
        !          9288: �?�<z
        !          9289: �L�
        !          9290: �X�
        !          9291: �l�
        !          9292: ��q
        !          9293: ��?���%
        !          9294: ��e
        !          9295: �e
        !          9296: �,%
        !          9297: �F? �P
        !          9298: �^?��d
        !          9299: �xe
        !          9300: ��|
        !          9301: ��_
        !          9302: ��
        !          9303: �i
        !          9304: �(q
        !          9305: �<
        !          9306: �lq
        !          9307: ��q
        !          9308: ��
        !          9309: ��
        !          9310: ��
        !          9311: �
        !          9312: �(
        !          9313: �2?��8a
        !          9314: �\
        !          9315: �t}
        !          9316: ��e
        !          9317: ��e
        !          9318: ��'
        !          9319: ��%
        !          9320: ��?���a
        !          9321: �?��a
        !          9322: �,
        !          9323: �6?��`G
        !          9324: ��q
        !          9325: ��G
        !          9326: ��e
        !          9327: ��%
        !          9328: �e
        !          9329: �,%
        !          9330: �Hq
        !          9331: �d
        !          9332: ��
        !          9333: ��
        !          9334: ��i
        !          9335: �q
        !          9336: �
        !          9337: �D
        !          9338: �Ti
        !          9339: �|q
        !          9340: ��q
        !          9341: ��
        !          9342: ��?���

        !          9343: ���
        !          9344: ���
        !          9345: ���
        !          9346: �?��

        !          9347: �"?p�0z
        !          9348: �D�
        !          9349: �N?��Tz
        !          9350: �d�
        !          9351: �n?��tz
        !          9352: ���
        !          9353: ���
        !          9354: ���
        !          9355: ��q
        !          9356: ��?(���
        !          9357: ��?@��

        !          9358: ��
        !          9359: ��
        !          9360: � �
        !          9361: �.?x�^?8�hz
        !          9362: �x�
        !          9363: ���
        !          9364: ���
        !          9365: ��?���z
        !          9366: ���
        !          9367: ���
        !          9368: ���
        !          9369: �?�

        !          9370: ��
        !          9371: �(�
        !          9372: �<�
        !          9373: �N?��\z
        !          9374: �l�
        !          9375: �x�
        !          9376: ���
        !          9377: ��?H��

        !          9378: ���
        !          9379: ���
        !          9380: ���
        !          9381: ��?P��

        !          9382: ��
        !          9383: ��
        !          9384: �$�
        !          9385: �6?X�@

        !          9386: �P�
        !          9387: �\�
        !          9388: �p�
        !          9389: ��?`��

        !          9390: ���
        !          9391: ���
        !          9392: ���
        !          9393: ��?h��

        !          9394: ���
        !          9395: ���
        !          9396: ��
        !          9397: �?��(z
        !          9398: �8�
        !          9399: �D�
        !          9400: �X�
        !          9401: �j?��t

        !          9402: ���
        !          9403: ���
        !          9404: ���
        !          9405: ��?0��z
        !          9406: ���
        !          9407: ���
        !          9408: ���
        !          9409: ��
        !          9410: �?��z
        !          9411: �(�
        !          9412: �2?��8z
        !          9413: �H�
        !          9414: �R?��Xz
        !          9415: �h�
        !          9416: �r?��xz
        !          9417: ���
        !          9418: ��?���z
        !          9419: ��?���
        !          9420: ��q
        !          9421: �<G
        !          9422: �R?��X
        !          9423: �p7
        !          9424: ��? ��
        !          9425: ��.
        !          9426: ��?(��
        !          9427: ��v
        !          9428: ��'
        !          9429: ��?@�
        !          9430: �Z?H�\
        !          9431: �p

        !          9432: ��b
        !          9433: ��}
        !          9434: ��?���
        !          9435: �?��
        !          9436: �?��
        !          9437: �?�� 
        !          9438: �*?��,
        !          9439: �6?�8
        !          9440: �B?�D
        !          9441: ��?8��z
        !          9442: ��R
        !          9443: ��?P�
        !          9444: �
        !          9445: ?X�
        !          9446: ��
        !          9447: �N?�T
        !          9448: �b?p�h
        !          9449: �z?��|
        !          9450: ��?���
        !          9451: ��?0��
        !          9452: ��R
        !          9453: ��?x�?��
        !          9454: �"?��$
        !          9455: �2?��4
        !          9456: �B?��D
        !          9457: �R?��T
        !          9458: �b?`�l
        !          9459: �z?h��
        !          9460: ��?��
        !          9461: ��?���
        !          9462: �q
        !          9463: �c
        !          9464: �P
        !          9465: �`i
        !          9466: ��
        !          9467: ��i
        !          9468: ��?���
        !          9469: ��
        !          9470: ��i
        !          9471: �q
        !          9472: �? �$
        !          9473: �<7
        !          9474: �n?��p
        !          9475: �|.
        !          9476: ��?���
        !          9477: ��v
        !          9478: ��'
        !          9479: ��?��
        !          9480: ��%
        !          9481: �?�
        !          9482: � �
        !          9483: �(
        !          9484: �T
        !          9485: �`C
        !          9486: �p�
        !          9487: �xF
        !          9488: ��?��
        !          9489: ��%
        !          9490: ��?���
        !          9491: ��?��
        !          9492: �(
        !          9493: �L
        !          9494: �\i
        !          9495: �t
        !          9496: ��
        !          9497: ��i
        !          9498: ��
        !          9499: ��
        !          9500: ��G
        !          9501: �
        !          9502: �2?��4
        !          9503: �F?��H
        !          9504: �Z?��\
        !          9505: ��_
        !          9506: �p�
        !          9507: ��?(��Z
        !          9508: ��Z
        !          9509: ��_
        !          9510: ��G
        !          9511: �|_
        !          9512: ���
        !          9513: ��?0��
        !          9514: ��?8��
        !          9515: ��?@�
        !          9516: �~?H��1
        !          9517: ��?P��x
        !          9518: ��?X��x
        !          9519: ��?`��x
        !          9520: ��&
        !          9521: �W
        !          9522: �H\
        !          9523: �r?h�t
        !          9524: ��?@��
        !          9525: �&&C@�3�&&C`� 3�0&&C��83�H&&D�P3�`&&D��h3�x&&F��3��&&F ��3��&&F@��3��&&F`��3��&&F���3��&&F���3�&&F��3� &&G��(3�8&&G��@3�P&&G��X3�h&&H�p3��&&H���3��&&Ip��3��&&K���3��&&R0��3��&&S`��3��&&U��3�&&X@�3�(&&Xp�03�@&&X��H3�X&&Y��`3�p&&Y��x3��&&Y���3��&&Y���3��&&[`��3��&&]���3��&&^���3�&&cp�3�&&dp� 3�0&&f��83�H&&g��P3�`&&h��h3�x&&k��3��&&n���3��&&p���3��&&w@��3��&&x���3��&&y���3&&&{@&3& &&~�&(3&8&&~�&@3&P&&�&X3&h&&��&p3&�&&��&�3&�&&��&�3&�&&��&�3&�&&��&�3&�&&��&�3&�&&��&&3&&&&�&&3&&(&&��&&03&&@&&��&&H3&&X&&� &&`3&&p&&��&&x3&&�&&�`&&�3�H�
        !          9526: �`u
        !          9527: �8n
        !          9528: �dm
        !          9529: �t�
        !          9530: ��n
        !          9531: ���
        !          9532: ��u
        !          9533: ��m
        !          9534: &&�&&��&&�3&&�&&��&&�3&&�&&��&&�3��
        !          9535: ��q
        !          9536: &&�&&�@&&�3&&&��&3�b?��d
        !          9537: ��?p��
        !          9538: ��?x��
        !          9539: ��q
        !          9540: &&&��& 3&0&&�&83&H&&��&P3&`&&��&h3&x&&��&�3&�&&�`&�3&�&&��&�3&�&&��&�3&�&&��&�3���
        !          9541: ���
        !          9542: ��]
        !          9543: &�&&�0&�3&&&� &3& &&�`&(3&8&&��&@3&P&&�`&X3��
        !          9544: � �
        !          9545: &h&&��&p3��?�&�&&��&�3&�&&��&�3&�&&� &�3&�&&��&�3�n?��pl
        !          9546: �Xl
        !          9547: &�&&�0&�3&�&&Š&3�
        !          9548: &&&��&3�P-
        !          9549: &(&&�0&03ǒ?�Ǹ�
        !          9550: &@&&ƀ&H3& &1� &@&1�p�([
        !          9551: Ȝ[
        !          9552: �[
        !          9553: �B?��D&
        !          9554: &X�`&
        !          9555: &X�?���&
        !          9556: &X�&
        !          9557: &X��&
        !          9558: &X�D
        !          9559: �8&
        !          9560: &X���
        !          9561: ��G
        !          9562: �&
        !          9563: &X�t&
        !          9564: &X���
        !          9565: �G
        !          9566: �4&
        !          9567: &XΔ&
        !          9568: &X�$

        !          9569: �4&
        !          9570: &Xτ�
        !          9571: Ϩ&
        !          9572: &X�4�
        !          9573: �`G
        !          9574: Є&
        !          9575: &Xм

        !          9576: �$&
        !          9577: &X�@�
        !          9578: ��D
        !          9579: ��&
        !          9580: &X�D�
        !          9581: �h&
        !          9582: &XԔ&
        !          9583: &�&X&&��&`3&p&&�@&x3&�&&�`&�3&�&&�p&�3&�&&� &�3&�&&Ԑ&�3� -
        !          9584: �8N
        !          9585: &�&&��&�3�v?���?��P&
        !          9586: &�3
        !          9587: �B?��3
        !          9588: �$�
        !          9589: ܤ�
        !          9590: ��&
        !          9591: &�&
        !          9592: &�@&
        !          9593: &�f?�ݔ&
        !          9594: &ݤ&
        !          9595: &ݶ?���&
        !          9596: &��&
        !          9597: &�F?�ވ&
        !          9598: &ޘ&
        !          9599: &&&&�p&3&&&��& 3&0&&��&83& `&&
        !          9600: `&&
        !          9601: �&&`&&�&&`&&
`&&`&&`&&`&&`&&`&&?&&`&&`&&`&&`&&`&&`&&`&&`&&`&&`&&`&&`&& `&&!`&&"`&&#`&&$`&&%`&&&`&&'`&&(`&&)`&&*`&&+`&&,`&&-`&&.`&&/`&&0`&&1`&&2`&&3`&&4`&&5`&&6`&&6�h)&6�h'&7h&7h&7?&&7�?&&7�&&7�&&7�&&7�y&&7�&&&&7�;&&7�=&&7�&&7�&&ޠ&7�&&�&88&&8&&��&8&&��&8&&�&8 &&�8&8(=&&8@8&&8H&&�P&8P8&&8Xy&�&8`&&�&8hj&&8p&&�`&8x$&&8�0&&8�9&&8�w&&8�&@&8�&&8�w&&8�>&&8�&&߰&8�d&&8�j&&8�&&߸&8�&&��&8�&&��&8�&&�&8�&&�8&8�&&�P&9&&�h&9&&��&9&Hp&9&&��&9 &&�&9(&&��&90&&��&98&&�&9@&&�&9H&&�0&9P&&�@&9X&&�P&9`&&�`&9h&&�p&9p�&&9x&&�&9�&&�&9�&&&8&9�&&�&9�&&�&9�&&��&9�&H�&9�&&��&9�&&��&9�&&��&9�&&��&9�&&��&9�&&�&9�&&�&9�&&� &9�&&�0&9�&&�H&:&&�X&:&&��&:&&��&:&&��&: &&�`&:(&&�p&:0&&�x&:8&&�&:@&&�&:H&&�&:P&&�&:X&&��&:`&&��&:h&&��&:p&&��&:x&&��&:�&&�&:�&&�&:�&&� &:�&&�0&:�&&�@&:�&&�P&:�&&�`&:�&&�p&:�&&�x&:�&&�&:�&&�&:�&&�&:�&&�&:�&&�&:�&&��&:�&&��&;&&��&;&&��&;&&;&&��&; &&��&;(&&�&;0&&�&;8&&� &;@&&�(&;H)&&;PO&&;X(&&;`V&&;h&&�X&;p&&�@&;x&&�@&;�&&&�&;�j&&;�&&�H&;�&I4&;�&&�p&;�&&;�&I�&;�=&&;�&0I�&;�&&�&;�&&&�&;�&0O�&;�p&&;�&&;�&&&�&<&&�&<&0O�&<&1��&<&&�&< &1��&<(&&�&<0&&�&<8&&�&<@&&�&<H&&�&<P&&��&<X&&��&<`&&��&<h&&�@&<p&&�h&<x&1��&<�&&�p&<�&&�x&<�&&�&<�&&�&<�&&&�&<�&1��&<�&&�&<�&&�&<�&&�&<�&&��&<�&&��&<�&&��&<�&&�&<�&1��&<�&&&�&<�&&�&=p&&=&&� &=&&�&=&&�(&= &&�0&=(&&�H&=0&&�&=8&&�p&=@&&�8&=H&&�&=P&&�&=X&&�&=`&&��&=h&&�&=p&&�H&=x&&�P&=�&&�X&=�&&&&=�&&�`&=�&&�&=�&&�&=�&&��&=�&&��&=�&&�(&=�&&�`&=�&&�&=�&&��&=�&&��&=�&&� &=�&&�@&=�&&�h&=�&&�&>&&�&>&&��&>&&�&>&&�@&> &&�D&>(&&�`&>0&&�p&>8&&�&>@&&�&>H&&�&>P&&��&>X&&�X&>`&&��&>h&&�0&>p&&�p&>x&&�&>�&&��&>�&&��&>�&&�&>�&&�(&>�&&�`&>�&&�&>�&&��&>�&&��&>�&&�&>�&&�8&>�&&�&>�&&�X&>�&&�&>�&&��&>�&&��&>�&&�&?&&��&?&&��&?&&�&?&&�8&? &&��&?(&&�`&?0&&�p&?8&&�&?@&&�&?H&&�&?P&&��&?X&&�&?`&&�h&?h&&�&?p&&�&?x&&��&?�&&�&?�&&�8&?�&&�&?�&&�X&?�&&��&?�&&��&?�&&�&?�&&�(&?�&&�8&?�&&�@&?�&&�&?�&&�&?�&&�h&?�&&�&?�@&&?�&&�&@&&�&@&&�&@&&�&@&&��&@ &&�&@(&&�&@0&&�0&@8&1�&@@�&&@HE&&@P&&�$&@X&&�X&@`&1��&@h&&�X���������H0net_vethELF&&�@�@8&@&����P� ���|��"��b��&�!��8��}iXPx`�@�@�#�b�}d[x� �A(| ��i�IN�!�A(8`8!p�&|�N� �"���$| Px!A�,0��9i&x ||     P|     �8� 9)&B��HA`K���&�8`N� ```|��"�0�����&����|�#x��(�!����?�     �c�A�,8`8!��&��������|�N� ```�#H肀88~8�     �A(| ��i�IN�!�A(/�@�����>��@�?�K���&�```|���������|�#x8��&�!��g���€(xd,x8�8�8�99 �~HM`|dy@� 8!���x�&��������|�N� �>�b�H;����)�     �A(| ��i�IN�!�A(K���&�`|��A���a��|zx|�#x�&����?����������c������!���!�A��(��x�```�?� x&�}I}i.�*U`�@@�&y`�;�A�X����@A��/�|��A�@8���yk x� }yZ8�&I�x|��```�9k&� 9)&B��!t��p8`&���pHA`�?8     &x /��@��= =)��= /�A��88!���x�&�!���A���a��|���������������N� `�=�b�P�)� �A(| ��i�IN�!�A(K��\`8!�;���x�&�!���A���a��|���������������N� &�|�������(�&�!���?�     /�@� 8!�8`�&����|�N� `��8`&H!`�(/�A�(�?�)@�     �A(| ��i�IN�!�A(�0/�A�(�?�)@� �A(| ��i�IN�!�A(�/�A�(�?�)@� �A(| ��i�IN�!�A(�8/�A�(�?�)@� �A(| ��i�IN�!�A(�?8!�88`����� �&|�N� &�&|���������8`�&�a����(���������!�Q���/�A�,8!��&�a��������|���������N� `= ��8��? �?8` �)8� �A(| ��i�IN�!�A(�?8�8�08`&�(�)8� �A(| ��i�IN�!�A(�?�8``c��)0� �A(| ��i�IN�!�A(�0/��8A����(/�A���?/�A��/�A��8�<��P��y&,`&`cx8&y��@8`&;�H&�`|dy@�&�;�?��c�c����x``�?@��8`&| �|     �*�&t;���p�pH&u`��@����;8!�8&8`�a������     �&�������|�����N� �?�b�X�)� �A(| ��i�IN�!�A(�(/�A�(�?�)@� �A(| ��i�IN�!�A(�0/�A�(�?�)@� �A(| ��i�IN�!�A(�/�A�(�?�)@� �A(| ��i�IN�!�A(�88`��/�A��|�?|x�)@� �A(| ��i�IN�!�A(8`��K��L�?�b�`�)� �A(| ��i�IN�!�A(K��&�D"N� xf��8`X8�&D"N� }H�H-}H�,M� = �a)8��|dH�8�&��N� |dx8`��= �a)8����|0@L� 8`TD"= �a)8��8`�i(M� 8`������N� ���|dx8`&D"N� 9`}*Kx}     Cx|�;x|�3x|�+x|�#x|dx8`& D"N� |�#x|dx8`<D",#|�#xM� 8`��N� |�+x|�#x|dx8`@D"N� Module size (%llu bytes) is too big!
        !          9602: IBM,l-lanveth: Error %ld sending packet !
        !          9603: veth: Dropping too big packet [%d bytes]
        !          9604: veth: Failed to allocate memory !
        !          9605: veth: Error %ld registering interface !
        !          9606: &�p�X�@�(�
        !          9607: �������&����&�����p����0����p������P��        ��P���
        !          9608: ��        ��� ��
        !          9609: �
        !          9610: H�
        !          9611: pGCC: (GNU) 4.4.5.symtab.strtab.shstrtab.rela.code.branch_lt.rela.got.bss.comment &���x�   &&&��p6&��h1&8 ;��p`@&0p&&�I&&�&h
        !          9612:         �{&&�������&�P&��&��(��4���PA&�P&��\&�      Pp&��__bss_end.hv_hascharveth_module_init__bss_start__module_end__module_startmodule_inithv_send_logical_lanhv_generic�&?�*?�N?��?��/$��
        !          9613: �&& �3�&?0�&?(�&f?8�&�?@�&�?(�

        !          9614: �6?H��?(�X
        !          9615: ��?P�:?(�x
        !          9616: ��?(��
        !          9617: �$
        !          9618: �n?X�f?`�
        !          9619: �&&p�
        !          9620: �&&X�
        !          9621: �&&@�
        !          9622: �&&(�
        !          9623: �&&
        !          9624: ��
        !          9625: �&&��3�&&&�3�(&&&��03�@&&p�H3�X&&0�`3�p&&p�x3��
        !          9626: ��H��H��H��H� H� H��    &��
        !          9627: &��&��&&     ���&��&��&&
        !          9628: ���&&        ���&��&& ���&&
        !          9629: ��&&
        !          9630: H��&&
        !          9631: p��������)(�0net_e1000ELF&&�@(@8&@&���HV�� ���|��"��b��&����8��}iXPx`��!��|ix@�D�#�b�}d[x� �A(| ��i�IN�!�A(8`8!��&����|�N� �b���$|Px!A�,0��9K&x |
        !          9632: |P|        �8�9k&B����(�i��A�8`K����b�0|�#x�+H&M`/�A�����8��x�K��l&�&|��"�@�b�H8��&�!���)�|c�)X� �A(| ��i�IN�!�A(8!px` xc�T D.T�>} xTiD.Tc�>T�}#x|x�&xc |�N� &�`|��"�@�b�H8��&�!��x� T
        !          9633: D.T�>}Jxx��T�D.T��>}#xUJ�}D#xx� �)�k|cZ�)`�        �A(| ��i�IN�!�A(8!p�&|�N� &�`�c|ixm`��/���A�8`��N� `�/�A����P9@9g``�9J&/�@@A���9k@���/�A���y@.�yJ$|
        !          9634: P�B�H8`|�=j��
        !          9635: 8�
        !          9636: �I�        �K@(�@ �     �@)N� ��P9@K���```|����������&������X�����!�q�/�A�&�8`&8�K��m8�8`K��a뢀@8`
        !          9637: �=�)�      �A(| ��i�IN�!�A(8`(8�K��)8`(8�K��8`88�K��8�8`8K��8`TK��mxd`8`TK���8`K��Ydd�8`x� K����=8`
        !          9638: �)�  �A(| ��i�IN�!�A(8`K��dd8`x� K����=8`
        !          9639: �)�  �A(| ��i�IN�!�A(�=8�8�낀H�)(?���@(��@)�     �A(| ��i�@�I�~@ N�!�A(�=�@0<���x`�@*|�"�)&0� �A(| ��i�IN�!�A(8�8!�8`�&����������|�����N� &�``8`N� ```|���������||x8`(�&���������!�qK����"�H?��@�A�9)x&���yj�@�08!�;���x�&����������|�����N� `}i��?&��x��yk��y)�Ɖ_})[xyEƉ}KxxƉ?|CxyJ��}Jxyk��}kSxy)E�})[x|     Kx�y+ y)"y* yh UGD.UD.y)�yk�U�>UJ�>|�Cx|�SxU(D.UgD.U)�>Uk�>|�[x}     Kx��@0UJ�TD.T��T�>�x|�[x}IKx;���y) x��|�Kx��|� P{� H        M`88�8�H�`|���@8`(K���>@8!���x8  &T~������@�&��������|�N� &�|���������8`�&������X�&���!���A���a�����������!�1�/�A�@8!��&�����&���!��|��A���a����������������N� ``�€@낀H<�8�`�@*��x?��>�)&(� �A(| ��i�IN�!�A(�>��@(8�8���@)||P�}@0�}@ �) � �A(| ��i�IN�!�A(��x�>Tc6�k       �)p�   �A(}c[x|     ��i�IN�!�A(�>��@(8�8���@)�}@ �) � �A(| ��i�IN�!�A(8���x� �}@8`�K��E8`K���x`��@���>8`d;`0�)� �A(| ��i�IN�!�A(8`K��q|`xHD`�>;{���)�     �A(| ��i�IN�!�A(8`K��5{{!|`xA�8x ��8`dA���9`9?P}i�8�i9)&|x B��/�;!p;@��xA���S�R�?P��Qx�(yk�(��U}kxT�@.�T}iKx{�D(|�Kx�xx� 8`TK��1gĀ8`Tx� ;�TK����x8�K��8~;�xc 8�{� K���/�T�@���;;\;<��x[�x<�x�x��x8�8�H�`|��@0|�;�0x  x"x y* UFD.UgD.x�y)�UJ�>Uk�>|�Sx|�[xU&D.TD.U)�>T�>|�Kx|�xUJ�Uk�}IKx}`xy)�x } x�;���@��lB8`8{"K��-{ 8`8K��!8`88�K��8`88�K��   8`88�K���<�8``��?�K���8`&8�K���;�x;�(^�x��x``��x8�8�H�`|��@0|�;�0x        x"x y* UFD.UgD.x�y)�UJ�>Uk�>|�Sx|�[xU&D.TD.U)�>T�>|�Kx|�xUJ�Uk�}IKx}`xy)�x } x�;���@��l8ZB�@8`({D"K��{D 8`(K��   8`(8�K���8`(8�K���8`(8�K���8`( 8�K���8�8`&`��K���8&8`�K��<�x   ��A�&<;`8�D 08``�&x� K���8`K���i9|`x@���>8`&:���)� �A(| ��i�IN�!�A(8`K���|`xHL```�>:����)�     �A(| ��i�IN�!�A(8`K��uz�!|`xA��| �98`&A���;Z&T�>{Z �;9/�@���x     ��@����t�!r�&pW��>�?R��TU*�>T�>y)��Q�P}$x�_S�UK��T`xk��8`��A���K���x��;`8�A���K���|k�9@��p�8�b�`�)� �A(| ��i�IN�!�A(8`��K���8`K��xk��A��X��tk�&��tK��L&�     ``|���������||x8`8�&����|�#x�����!�qK��9|x8`8K��-;�W�~�|}xA�&H�b�Hx`&���x{� 9+=�}i��@0�&���?�_yk��x��|[xx�EƉ|�xy)ƈ});xyJ��}JKxyk��?}kSxxE�|[x} xx  x"x y* UgD.UCD.x�y)�UJ�>Uk�>|cSx|�[xT
        !          9640: D.U'D.T�>U)�>|�Kx}@xUk�Tc�|cKx}`xx xc�|cx|hPH�`{� T    �>T@.|Kx9 �?�9 �?|�8�&8`8x�`K��8!���x�&����������|�����N� 8!�;���x�&����������|�����N� &�,%M� 8���x� x� |ix8�&|����9)&B��N� ,%M� 8���|ixx� 8�&|��`�8�&� 9)&B��N� Module size (%llu bytes) is too big!
        !          9641:  �� �����y�0z�P{�p����&��'��(��������v� w�0x�@|�P&�X&�h&�x&��Failed to read MAC address from EEPROM!
        !          9642: 82547EI/GI Copper82547EI Mobile52546EB Copper, Dual Port82546EB Fiber, Dual Port82546GB Copper, Dual Port82546GB Fiber, Dual Port82546GB SerDes, Dual Port82545EM Copper82545EM Fiber82545GM Copper82545GM Fiber82545GM SerDes82544EI Copper82544GC Copper82541EI Copper82541EI Mobile82541GI Copper82541GI Mobile82541ER Copper82541PI82540EM Mobile82540EP Mobile82540EP Desktop82540EM Desktop&���8�h���P�& ����&�����@������������ ���������
���������������P�V����V����P��P�`�@����GCC: (GNU) 4.4.5.symtab.strtab.shstrtab.rela.code.branch_lt.rela.got.bss.comment &�����    &&&���6&��`h1'�&8 ;�P�@H@&0�&&�I&&�&�
        !          9643:         h�&&����P��&&��D&� ��V��P4�P@&��<G&��X\���V�i&�x&�&memcpycheck_driver__bss_endsnk_kernel_interface__bss_startmemsetsnk_module_interface__module_end__module_startmodule_init�&?�*?�V?��?��/$��?(��?0��
        !          9644: �&?8�&& �3�&&?@�&*?H�&�?@�&�?H�n?P��?H��?P�&?X�D&
        !          9645: �P&
        !          9646: �V?@��&
        !          9647: ��&
        !          9648: ��&
        !          9649: ��&
        !          9650: ��&
        !          9651: ���&
        !          9652: ��&
        !          9653: ���&
        !          9654: �&
        !          9655: ��&
        !          9656: �R?H�D&
        !          9657: ��J?H��
        !          9658: ��
        !          9659: ��&
        !          9660: �
        !          9661: ?X�r?@�v?H�l&
        !          9662: �t&
        !          9663: ���&
        !          9664: ���&
        !          9665: �� �&
        !          9666: � �&
        !          9667: � �&
        !          9668: � �&
        !          9669: � �
        !          9670: �
        !          9671: �&
        !          9672: �
        !          9673: �&
        !          9674: �
        !          9675: �&
        !          9676: �
        !          9677: �&
        !          9678: �
        !          9679: �&
        !          9680: �
        !          9681: �&
        !          9682: �
        !          9683: �&
        !          9684: �
        !          9685: �
        !          9686: ��&
        !          9687: ��&
        !          9688: ��&
        !          9689: ��&
        !          9690: ��&
        !          9691: ��&
        !          9692: ��&
        !          9693: � &
        !          9694: �(&
        !          9695: ��h&
        !          9696: ���&
        !          9697: ��
b?`�
�&
        !          9698: ��
�&
        !          9699: ��
�&
        !          9700: ��?H��
        !          9701: �(&
        !          9702: ��&&���&&8��&&h��&&���&&P��&&& ��3�&&&��3� &&@�(3�8&&�@3�P&&�X3�h&& �p3��&&���3��&&
���3�P&&��h&&���&&���&&��&&0��&&P��&&p��&&��&&��(&&��@&&��X&&��p&&���&&���&&��&&��&& ��&&0�&&@�&&P�0&&X�H&&h�`&&x�x&&���&&���3��&&���3��
        !          9703: &��
&��&��&&�&�&�&�&�         &�(&�0&&@�8&&��@&&���������'X' 0net_virtioELF&&�@�@8&@&����� ��@|��"��b��&����8��|�#x}iXPx`����������!�q|x@�P�#�b�}d[x;��       �A(| ��i�IN�!�A(8!���x�&�����������|�N� ���"�$8�|x|HPx H    1`뢀8�b�(�"�0���@�]������PA�;�K�����x��xH�`/�A��xK���&�8`��N� ```|�/����������|�#x�&�����!�qA���"�X�€`9��IP�      8�iH�
        !          9704: U<|��|�&�|�@P|��x�&�8�&|�"x�&�}*x� �!*;�&��|k)*;�&������9�
        !          9705: �����j}�|&�}`XPyk�}JZ��|��)P�b�h8�&�i8&�  H!`8!���x�&�����������|�N� ``�"�H�b�P;��)�)� �A(| ��i�IN�!�A(8!���x�&�����������|�N� &�`|���������;��&������X뢀p�a������|{x�!�a�?(�}�     �XA���}K�}J&�}jXPykH})Z����9<&;������&����HP� ��A���?{�&�c�x{� ;���|�*H�`�? ��9&� �}@[�}jY�|Px�})��|��? �b�h8��i8&� H    �`8!���x�&�a��������|���������N� ```�"�H�b�x|�#x�)�)�  �A(| ��i�IN�!�A(K��(&�|����������&�!��� �?� /�A�0�€h8����xH        =`��xH�`�?8�      8!�8`�&��������|�N� &�`|���������8`�&����� �!�q�?�     /�A�$8!��&�����������|�N� `�€h8���xH�`��x8�H�`뢀H8`_@�=�)0� �A(| ��i�IN�!�A(邀X/��lA���,�L 9`;�
        !          9706: 8�8��8�898�&���������      �jy 9
        !          9707: /� �i��8c��      9J9) @���|��, �(9`&9@��x8��I�i�B�p�,P��
        !          9708: �    �iH�`��x8�H=`�?8!�8&8`������� �&����|�N� �=�b���)� �A(| ��i�IN�!�A(��x8��H)`8`��K��\&���������|��‘�����&�&��8�!���A���a������������!�!�/��A�<8`��8!��&�����&���!��|��A���a����������������N� �$8 �+�?A����$$<�@���뢀���8��d�8��=�) �     �A(| ��i�IN�!�A(x`��apA�\|+xxcd�=; ;���x�kq�)p� �A(}c[x|     ��i�IN�!�A(�&p��x�H=`�b��{�&�{�6d��P�8`@8�{�D(8���*D"�8`<8�8�D"/�8`���=��x� xc @�x�D(x��|c#x�|�I8HE`��A(8�xc | ��z�Z{��Z�;Z&{Z&�N�!�A([�/�|wx�zA�&�|H&�`8�xe ~�xH&M`��8`@8�|ft|&�8�x x  x�U&D.U)�>|�KxT     D.T�>} xTƀ|�xx� D"�<�;9��;�&{9!��y+dy)&�|J9+�} J� y)��<(@���8뢀�;��&��8`<8�&|��D"/�}=�x� A�8���&���<;�&5 ���!�@�����x8�&H&`8`K��@�8�b���)�     �A(| ��i�IN�!�A(8`��K���=�b��K���&� ,%M� 8���x� x� |ix8�&|����9)&B��N� ,%M� 8���|ixx� 8�&|��`�8�&�     9)&B��N� xi&�89)�x(xc$|     8c�x�xc�|`N� ``����|x8`�/�@�Tx� �8`@T��>T�@.|�x8�x� 8�D"|��8`<8�8�D"/�8`��xc A�����N� x� ����T�@.|c4T��>|c#xxc N� &`����|x8`�/�@�|x� �8`@T��>T�@.|�x8�x� 8�D"|��8`<8�8�D"/�@�Dx� x  x�U+�>U#@.|c[xT     D.T�>} xTc�|cxxce����N� ``�b������N� &``|���������|}x|�#x�&�����!�qK��!��x|x��xK��q8!�xc&��&���|��������|�N� &�```|���������|}x|�#x�&�����!�qK��q��x|x��xK��&8!�;��xcd�&����{����������|�N� &�`�/�L� �8�&8`@8�8�D"N� ```�/�L� x� �8`@T��>T�@.|�x8�x� 8�D"N� ```�/�L� �x� 8`@8�&8�D"N� ```�/�L� �x� 8`@8�8�D"N� ```�����|ix|�#x��������8`��/�@�0��/�;�A��A�,/�&A��8`��```�����������N� /�A��/�@���8`<8�|��D";���/�{��@�x��8�8`<|�*8�D"/�x� A�8���x� |��x�����������N� |�"8`<8�D"/�x� A��h8`��xc K��\``|�"8`<8�D"/�x� A��88`��xc K��,``|�"8`<8�&D"/�x� A��8`�K�������|�3x��������/�A�(;���x�����������N� ```/��@���9&��;�y) ��9)&|�#x�!��``8`<8�&��xD"/�x� A�8����;�&;�&�&��5 ���!��@�����x�����������N� Module size (%llu bytes) is too big!
        !          9709: virtionet: Packet too big!
        !          9710: virtio-net: Receive buffer not big enough!
        !          9711: virtionet: Failed to allocate buffers!
        !          9712: First BAR is not an I/O BAR!
        !          9713: malloc failed!
        !          9714: 
        !          9715: &���������x�&0��@�&P��@����@� ��@����@����@�     ���@�
        !          9716: 0��@�
        !          9717: ���@�
        !          9718: ���@�`��@� ��@����@�
��@�
@��@�
���@�
���@���@�p��@����@������ ���h� ���������� ������ �����GCC: (GNU) 4.4.5.symtab.strtab.shstrtab.rela.code.branch_lt.rela.got.bss.comment &��@�        `    &&&�@�6&�@��1$�@ ;���@&0�&&�I&&��
        !          9719:         0&O&&��@��@&&�h�&�88)&� D0&� XD��N� `Q��[&��Do��&��X���&�<�&��4��������&��&�P�&&��4&&�&&&��4&8&��dvirtio_get_vring_descvirtio_vring_sizememcpyvirtionet_interface__bss_endvqvirtiodevvirtio_queue_notifysnk_kernel_interfacevn_module_init_pci__bss_startmemsetvirtio_reset_devicesnk_module_interface__module_end__module_startvirtio_get_qsizevirtio_set_statusmodule_initvirtio_set_guest_featuresvirtio_get_vring_avail�&?�*?�b?��?��/$��
        !          9720: ��?8��?(��?0��?@�&
        !          9721: �&& �3�&v?X�&z?`�?h� 

        !          9722: �R?H�V?P��?X��?p�P
        !          9723: ��?h��

        !          9724: ��?H��?x�6?��J?h�T
        !          9725: �`
        !          9726: ��?���?h��
        !          9727: �
        !          9728: �?H�B?X��?p��
        !          9729: �

        !          9730: �>?��h
        !          9731: �8&&��@&&��X&&��`&&��h&&x�x&&&0��3��&&&P��3��&&���3��&& ��3��&&���3��?��2?���
        !          9732: ��?��<
        !          9733: ��
        !          9734: ��
        !          9735: � >?�� �
        !          9736: � �?�� �?���&&���3�&& ��3� &&
        !          9737: 0�(3�?��@
        !          9738: �P
        !          9739: ��
        !          9740: ��
        !          9741: �8&&
        !          9742: ��@3�P&&
        !          9743: ��X3�h&&`�p3��&& ��3��&&���3��&&
��3��&&
@��3��&&
���3��&&
��3�&&�3�(&&p�03�@&�H&�P&&@�X&�`
        !          9744: &�h&�p&�x        &��&��&��&&h��&��&&��&��&��&&���&��&&��� &��&��&��&&���&��&&��������<�<](ide.fs1 encode-int s" #address-cells" property
        !          9745: 0 encode-int s" #size-cells" property
        !          9746: : decode-unit  1 hex-decode-unit ;
        !          9747: : encode-unit  1 hex-encode-unit ;
        !          9748: 0 VALUE >ata                                 \ base address for command-block
        !          9749: 0 VALUE >ata1                                \ base address for control block
        !          9750: true VALUE no-timeout                        \ flag that no timeout occured
        !          9751: 0c  CONSTANT #cdb-bytes                      \ command descriptor block (12 bytes)
        !          9752: 800 CONSTANT atapi-size
        !          9753: 200 CONSTANT ata-size
        !          9754: : ata-ctrl! 2 >ata1 + io-c! ;                      \ device control reg
        !          9755: : ata-astat@ 2 >ata1 + io-c@ ;                     \ read alternate status
        !          9756: : ata-data@ 0 >ata + io-w@ ;                       \ data reg
        !          9757: : ata-data! 0 >ata + io-w! ;                       \ data reg
        !          9758: : ata-err@  1 >ata + io-c@ ;                       \ error reg
        !          9759: : ata-feat! 1 >ata + io-c! ;                       \ feature reg
        !          9760: : ata-cnt@  2 >ata + io-c@ ;                       \ sector count reg
        !          9761: : ata-cnt!  2 >ata + io-c! ;                       \ sector count reg
        !          9762: : ata-lbal! 3 >ata + io-c! ;                       \ lba low reg
        !          9763: : ata-lbal@ 3 >ata + io-c@ ;                       \ lba low reg
        !          9764: : ata-lbam! 4 >ata + io-c! ;                       \ lba mid reg
        !          9765: : ata-lbam@ 4 >ata + io-c@ ;                       \ lba mid reg
        !          9766: : ata-lbah! 5 >ata + io-c! ;                       \ lba high reg
        !          9767: : ata-lbah@ 5 >ata + io-c@ ;                       \ lba high reg
        !          9768: : ata-dev!  6 >ata + io-c! ;                       \ device reg
        !          9769: : ata-dev@  6 >ata + io-c@ ;                       \ device reg
        !          9770: : ata-cmd!  7 >ata + io-c! ;                       \ command reg
        !          9771: : ata-stat@ 7 >ata + io-c@ ;                       \ status reg
        !          9772: 00 CONSTANT cmd#nop                                \ ATA and ATAPI
        !          9773: 08 CONSTANT cmd#device-reset                       \ ATAPI only (mandatory)
        !          9774: 20 CONSTANT cmd#read-sector                        \ ATA and ATAPI
        !          9775: 90 CONSTANT cmd#execute-device-diagnostic          \ ATA and ATAPI
        !          9776: a0 CONSTANT cmd#packet                             \ ATAPI only (mandatory)
        !          9777: a1 CONSTANT cmd#identify-packet-device             \ ATAPI only (mandatory)
        !          9778: ec CONSTANT cmd#identify-device                    \ ATA and ATAPI
        !          9779: : set-regs ( n -- )
        !          9780: dup
        !          9781: 01 and                                    \ only Chan 0 or Chan 1 allowed
        !          9782: 3 lshift dup 10 + config-l@ -4 and to >ata
        !          9783: 14 + config-l@ -4 and to >ata1
        !          9784: 02 ata-ctrl!                              \ disable interrupts
        !          9785: 02 and
        !          9786: IF
        !          9787: 10
        !          9788: ELSE
        !          9789: 00
        !          9790: THEN
        !          9791: ata-dev!
        !          9792: ;
        !          9793: ata-size VALUE block-size
        !          9794: 80000    VALUE max-transfer            \ Arbitrary, really
        !          9795: CREATE sector d# 512 allot
        !          9796: CREATE packet-cdb #cdb-bytes allot
        !          9797: CREATE return-buffer atapi-size allot
        !          9798: scsi-open                             \ add scsi functions
        !          9799: : show-regs
        !          9800: cr
        !          9801: cr ." alt. Status: " ata-astat@ .
        !          9802: cr ." Status     : " ata-stat@ .
        !          9803: cr ." Device     : " ata-dev@ .
        !          9804: cr ." Error-Reg  : " ata-err@ .
        !          9805: cr ." Sect-Count : " ata-cnt@ .
        !          9806: cr ." LBA-Low    : " ata-lbal@ .
        !          9807: cr ." LBA-Med    : " ata-lbam@ .
        !          9808: cr ." LBA-High   : " ata-lbah@ .
        !          9809: ;
        !          9810: : status-check               ( -- )
        !          9811: ata-stat@
        !          9812: dup   
        !          9813: 01 and                                    \ is 'check' flag set ?
        !          9814: IF
        !          9815: cr
        !          9816: ."    - ATAPI-Status: " .
        !          9817: ata-err@                               \ retrieve sense code
        !          9818: dup
        !          9819: 60 =                                   \ sense code = 6 ?
        !          9820: IF
        !          9821: ." ( media changed or reset )"      \ 'unit attention'
        !          9822: drop                                \ drop err-reg content
        !          9823: ELSE
        !          9824: dup
        !          9825: ." (Err : " .                       \ show err-reg content
        !          9826: space
        !          9827: rshift 4 .sense-text                \ show text string
        !          9828: 29 emit
        !          9829: THEN
        !          9830: cr
        !          9831: ELSE
        !          9832: drop                                   \ remove unused status      
        !          9833: THEN      
        !          9834: ;
        !          9835: : wait-for-ready
        !          9836: get-msecs                                 \ start timer
        !          9837: BEGIN
        !          9838: ata-stat@ 80 and 0<>                   \ busy flag still set ?
        !          9839: no-timeout and
        !          9840: WHILE                                  \ yes
        !          9841: dup get-msecs swap
        !          9842: -                                   \ calculate timer difference
        !          9843: FFFF AND                            \ reduce to 65.5 seconds
        !          9844: d# 5000 >                           \ difference > 5 seconds ?
        !          9845: IF
        !          9846: false to no-timeout
        !          9847: THEN
        !          9848: REPEAT
        !          9849: drop
        !          9850: ;
        !          9851: : wait-for-status          ( val mask -- )
        !          9852: get-msecs                                 \ initial timer value (start)
        !          9853: >r
        !          9854: BEGIN
        !          9855: 2dup                                   \ val mask
        !          9856: ata-stat@ and <>                       \ expected status ?
        !          9857: no-timeout and                         \ and no timeout ?
        !          9858: WHILE      
        !          9859: get-msecs r@ -                         \ calculate timer difference
        !          9860: FFFF AND                               \ mask-off overflow bits
        !          9861: d# 5000 >                              \ 5 seconds exceeded ?
        !          9862: IF
        !          9863: false to no-timeout                 \ set global flag
        !          9864: THEN      
        !          9865: REPEAT                  
        !          9866: r>                                        \ clean return stack
        !          9867: 3drop
        !          9868: ;
        !          9869: : cut-string      ( saddr nul -- )
        !          9870: swap
        !          9871: over +
        !          9872: swap   
        !          9873: 1 rshift                                  \ bytecount -> wordcount
        !          9874: 0 do
        !          9875: /w -
        !          9876: dup               ( addr -- addr addr )
        !          9877: w@                ( addr addr -- addr nuw )
        !          9878: dup               ( addr nuw -- addr nuw nuw )
        !          9879: 2020 =
        !          9880: IF
        !          9881: drop
        !          9882: 0 
        !          9883: ELSE
        !          9884: LEAVE         
        !          9885: THEN
        !          9886: over         
        !          9887: w!
        !          9888: LOOP
        !          9889: drop
        !          9890: drop
        !          9891: ; 
        !          9892: : show-model          ( dev# chan# -- )
        !          9893: 2dup
        !          9894: ."    CH " .                  \ channel 0 / 1
        !          9895: 0= IF ." / MA"                \ Master / Slave
        !          9896: ELSE  ." / SL"
        !          9897: THEN
        !          9898: swap
        !          9899: 2 * + ."  (@" . ." ) : "      \ device number
        !          9900: sector 1 +
        !          9901: c@
        !          9902: 80 AND 0=
        !          9903: IF
        !          9904: ." ATA-Drive    "
        !          9905: ELSE
        !          9906: ." ATAPI-Drive  "
        !          9907: THEN
        !          9908: 22 emit                       \ start string display with "
        !          9909: sector d# 54 +                \ string starts 54 bytes from buffer start
        !          9910: dup
        !          9911: d# 40                         \ and is 40 chars long
        !          9912: cut-string                    \ remove all trailing spaces
        !          9913: BEGIN
        !          9914: dup
        !          9915: w@
        !          9916: wbflip
        !          9917: wbsplit
        !          9918: dup 0<>                    \ first char
        !          9919: IF                   
        !          9920: emit
        !          9921: dup 0<>                 \ second char
        !          9922: IF
        !          9923: emit
        !          9924: wa1+                 \ increment address for next
        !          9925: false
        !          9926: ELSE                    \ second char = EndOfString
        !          9927: drop
        !          9928: true
        !          9929: THEN   
        !          9930: ELSE                       \ first char = EndOfString
        !          9931: drop
        !          9932: drop
        !          9933: true
        !          9934: THEN
        !          9935: UNTIL                         \ end of string detected
        !          9936: drop
        !          9937: 22 emit                       \ end string display
        !          9938: sector c@                     \ get lower byte of first doublet
        !          9939: 80 AND                        \ check bit 7
        !          9940: IF
        !          9941: ."  (removable media)"
        !          9942: THEN
        !          9943: sector 1 +
        !          9944: c@
        !          9945: 80 AND 0= IF                  \ is this an ATA drive ?
        !          9946: sector d# 120 +            \ get word 60 + 61
        !          9947: rl@-le                     \ read 32-bit as little endian value
        !          9948: d# 512                     \ standard ATA block-size
        !          9949: swap
        !          9950: .capacity-text ( block-size #blocks -- )
        !          9951: THEN
        !          9952: sector d# 98 +               \ goto word 49
        !          9953: w@
        !          9954: wbflip
        !          9955: 200 and 0= IF cr ."    ** LBA is not supported " THEN   
        !          9956: sector c@                     \ get lower byte of first doublet
        !          9957: 03 AND 01 =                   \ we use 12-byte packet commands (=00b)
        !          9958: IF
        !          9959: cr ."    packet size = 16 ** not supported ! **"
        !          9960: THEN
        !          9961: no-timeout not                \ any timeout occured so far ?
        !          9962: IF
        !          9963: cr   ."    ** timeout **"
        !          9964: THEN
        !          9965: ;
        !          9966: : pio-sector ( addr -- )  100 0 DO ata-data@
        !          9967: over w! wa1+ LOOP drop ;
        !          9968: : pio-sector ( addr -- ) 
        !          9969: wait-for-ready pio-sector ;
        !          9970: : pio-sectors ( n addr -- )  swap 0 ?DO dup pio-sector 200 + LOOP drop ;
        !          9971: : lba!  lbsplit   
        !          9972: 0f and 40 or                  \ always set LBA-mode + LBA (27..24)
        !          9973: ata-dev@ 10 and or            \ add current device-bit (DEV)
        !          9974: ata-dev!                      \ set LBA (27..24)
        !          9975: ata-lbah!                     \ set LBA (23..16)
        !          9976: ata-lbam!                     \ set LBA (15..8)
        !          9977: ata-lbal!                     \ set LBA (7..0)
        !          9978: ;
        !          9979: : read-sectors ( lba count addr -- ) 
        !          9980: >r dup >r ata-cnt! lba! 20 ata-cmd! r> r> pio-sectors ;
        !          9981: : read-sectors ( lba count addr dev-nr -- )
        !          9982: set-regs             ( lba count addr ) \ Set ata regs 
        !          9983: BEGIN >r dup 100 > WHILE
        !          9984: over 100 r@ read-sectors
        !          9985: >r 100 + r> 100 - r> 20000 + REPEAT
        !          9986: r> read-sectors
        !          9987: ;
        !          9988: : ata-read-blocks                ( addr block# #blocks dev# -- #read )
        !          9989: swap dup >r swap >r rot r>    ( addr block# #blocks dev # R: #blocks )
        !          9990: read-sectors r>               ( R: #read )
        !          9991: ;    
        !          9992: : set-lba                              ( block-length -- )
        !          9993: lbsplit                             ( quad -- b1.lo b2 b3 b4.hi )
        !          9994: drop                                \ skip upper two bytes
        !          9995: drop
        !          9996: ata-lbah!
        !          9997: ata-lbam!
        !          9998: ;
        !          9999: : read-pio-block                        ( buff-addr -- buff-addr-new )
        !          10000: ata-lbah@ 8 lshift                  \ get block length High
        !          10001: ata-lbam@ or                        \ get block length Low
        !          10002: 1 rshift                            \ bcount -> wcount
        !          10003: dup
        !          10004: 0> IF                               \ any data to transfer?
        !          10005: 0 DO                             \ words to read
        !          10006: dup                           \ buffer-address
        !          10007: ata-data@ swap w!             \ write 16-bits
        !          10008: wa1+                          \ address of next entry
        !          10009: LOOP
        !          10010: ELSE
        !          10011: drop                          ( buff-addr wcount -- buff-addr )
        !          10012: THEN
        !          10013: wait-for-ready
        !          10014: ;
        !          10015: : send-atapi-packet                    ( req-buffer -- )
        !          10016: >r                                  (   R: req-buffer )
        !          10017: atapi-size set-lba                  \ set regs to length limit
        !          10018: 00 ata-feat!
        !          10019: cmd#packet ata-cmd!                 \ A0 = ATAPI packet command
        !          10020: 48 C8  wait-for-status     ( val mask -- )  \ BSY:0 DRDY:1 DRQ:1
        !          10021: 6 0  do
        !          10022: packet-cdb i 2 * +                \ transfer command block (12 bytes)
        !          10023: w@
        !          10024: ata-data!                        \ 6 doublets PIO transfer to device
        !          10025: loop                             \ copy packet to data-reg
        !          10026: status-check                        ( -- ) \ status err bit set ? -> display
        !          10027: wait-for-ready                      ( -- ) \ busy released ?
        !          10028: BEGIN
        !          10029: ata-stat@ 08 and 08 = WHILE         \ Data-Request-Bit set ?
        !          10030: r>                               \ get last target buffer address
        !          10031: read-pio-block                   \ only if from device requested
        !          10032: >r                               \ start of next block
        !          10033: REPEAT
        !          10034: r>                                  \ original value
        !          10035: drop                                \ return clean
        !          10036: ;   
        !          10037: : atapi-packet-io                      ( -- )
        !          10038: return-buffer atapi-size erase      \ clear return buffer
        !          10039: return-buffer send-atapi-packet     \ send 'packet-cdb' , get 'return-buffer'
        !          10040: ;
        !          10041: : atapi-test ( -- true|false )
        !          10042: packet-cdb scsi-build-test-unit-ready     \ command-code: 00
        !          10043: atapi-packet-io                           ( )  \ send CDB, get return-buffer
        !          10044: ata-stat@ 1 and IF false ELSE true THEN
        !          10045: ;
        !          10046: : atapi-sense ( -- ascq asc sense-key )
        !          10047: d# 252 packet-cdb scsi-build-request-sense ( alloc-len cdb -- )
        !          10048: atapi-packet-io                           ( )  \ send CDB, get return-buffer
        !          10049: return-buffer scsi-get-sense-data         ( cdb-addr -- ascq asc sense-key )
        !          10050: ;
        !          10051: : atapi-read-blocks                    ( address block# #blocks dev# -- #read-blocks )
        !          10052: set-regs                            ( address block# #blocks )
        !          10053: dup >r                              ( address block# #blocks )
        !          10054: packet-cdb scsi-build-read-10       ( address block# #blocks cdb -- )
        !          10055: send-atapi-packet                   ( address -- )
        !          10056: r>                                  \ return requested number of blocks
        !          10057: ;
        !          10058: : atapi-read-capacity                        ( -- )
        !          10059: packet-cdb scsi-build-read-cap-10         \ fill block with command
        !          10060: atapi-packet-io                           ( )  \ send CDB, get return-buffer
        !          10061: return-buffer scsi-get-capacity-10        ( cdb -- block-size #blocks )
        !          10062: .capacity-text                            ( block-size #blocks -- )
        !          10063: status-check                              ( -- )
        !          10064: ;
        !          10065: : atapi-read-capacity-ext                    ( -- )
        !          10066: packet-cdb scsi-build-read-cap-16         \ fill block with command
        !          10067: atapi-packet-io                           ( )  \ send CDB, get return-buffer
        !          10068: return-buffer scsi-get-capacity-16        ( cdb -- block-size #blocks )
        !          10069: .capacity-text                            ( block-size #blocks -- )
        !          10070: status-check                              ( -- )
        !          10071: ;
        !          10072: : wait-for-media-ready                 ( -- true|false )
        !          10073: get-msecs                                 \ initial timer value (start)
        !          10074: >r
        !          10075: BEGIN
        !          10076: atapi-test                             \ unit ready? false if not      
        !          10077: not
        !          10078: no-timeout and
        !          10079: WHILE
        !          10080: atapi-sense  ( -- ascq asc sense-key )
        !          10081: 02 =                                \ sense key 2 = media error
        !          10082: IF                                  \ check add. sense code
        !          10083: 3A =                             \ asc: device not ready ?
        !          10084: IF
        !          10085: false to no-timeout
        !          10086: ."  empty (" . 29 emit        \ show asc qualifier
        !          10087: ELSE
        !          10088: drop                          \ discard asc qualifier
        !          10089: THEN                             \ medium not present, abort waiting
        !          10090: ELSE
        !          10091: drop                             \ discard asc
        !          10092: drop                             \ discard ascq
        !          10093: THEN
        !          10094: get-msecs r@ -                      \ calculate timer difference
        !          10095: FFFF AND                            \ mask-off overflow bits
        !          10096: d# 5000 >                           \ 5 seconds exceeded ?
        !          10097: IF
        !          10098: false to no-timeout              \ set global flag
        !          10099: THEN      
        !          10100: REPEAT
        !          10101: r>
        !          10102: drop
        !          10103: no-timeout
        !          10104: ;
        !          10105: 2 CONSTANT #chan 
        !          10106: 2 CONSTANT #dev
        !          10107: : #totaldev #dev #chan * ;
        !          10108: CREATE read-blocks-xt #totaldev cells allot read-blocks-xt #totaldev cells erase
        !          10109: : dev-read-blocks  ( address block# #blocks dev# -- #read-blocks )
        !          10110: dup cells read-blocks-xt + @ execute
        !          10111: ;
        !          10112: : read-ident  ( -- true|false )
        !          10113: false
        !          10114: 00 ata-lbal!                              \ clear previous signature
        !          10115: 00 ata-lbam!
        !          10116: 00 ata-lbah!
        !          10117: cmd#identify-device ata-cmd! wait-for-ready \ first try ATA, ATAPI aborts command
        !          10118: ata-stat@ CF and 48 =
        !          10119: IF
        !          10120: drop true                                          \ cmd accepted, this is a ATA
        !          10121: d# 512 set-lba                                     \ set LBA to sector-length
        !          10122: ELSE                                                  \ ATAPI sends signature instead
        !          10123: ata-lbam@ 14 = IF                                  \ cylinder low  = 14 ?
        !          10124: ata-lbah@ EB = IF                               \ cylinder high = EB ?
        !          10125: cmd#device-reset ata-cmd! wait-for-ready     \ only supported by ATAPI
        !          10126: cmd#identify-packet-device ata-cmd! wait-for-ready                     \ first try ata
        !          10127: ata-stat@ CF and 48 = IF               
        !          10128: drop true                                 \ replace flag
        !          10129: THEN
        !          10130: THEN
        !          10131: THEN
        !          10132: THEN
        !          10133: dup IF
        !          10134: ata-stat@ 8 AND IF                        \ data requested (as expected) ?      
        !          10135: sector read-pio-block 
        !          10136: drop                                   \ discard address end 
        !          10137: ELSE
        !          10138: drop false
        !          10139: THEN
        !          10140: THEN
        !          10141: no-timeout not IF                            \ check without any timeout ?
        !          10142: drop
        !          10143: false                                     \ no, detection discarded
        !          10144: THEN
        !          10145: ;
        !          10146: scsi-close                             \ remove scsi commands from word list
        !          10147: : find-disks      ( -- )   
        !          10148: #chan 0 DO                                      \ check 2 channels (primary & secondary)
        !          10149: #dev 0 DO                                    \ check 2 devices per channel (master / slave)
        !          10150: i 2 * j +
        !          10151: set-regs                                  \ set base address and dev-register for register access
        !          10152: ata-stat@ 7f and 7f <>                    \ Check, if device is connected
        !          10153: IF
        !          10154: true to no-timeout                     \ preset timeout-flag
        !          10155: read-ident        ( -- true|false )
        !          10156: IF
        !          10157: i j show-model                      \ print manufacturer + device string
        !          10158: sector 1+ c@ C0 and 80 =            \ Check for ata or atapi
        !          10159: IF
        !          10160: wait-for-media-ready             \ wait up to 5 sec if not ready
        !          10161: no-timeout and
        !          10162: IF
        !          10163: atapi-read-capacity
        !          10164: atapi-size to block-size      \ ATAPI: 2048 bytes
        !          10165: 80000 to max-transfer
        !          10166: ['] atapi-read-blocks i 2 * j + cells read-blocks-xt + !
        !          10167: s" cdrom" strdup i 2 * j + s" generic-disk.fs" included
        !          10168: ELSE
        !          10169: ."  -"                        \ show hint for not registered
        !          10170: THEN    
        !          10171: ELSE
        !          10172: ata-size to block-size           \ ATA: 512 bytes
        !          10173: 80000 to max-transfer
        !          10174: ['] ata-read-blocks i 2 * j + cells read-blocks-xt + !
        !          10175: s" disk" strdup i 2 * j + s" generic-disk.fs" included
        !          10176: THEN
        !          10177: cr
        !          10178: THEN    
        !          10179: THEN
        !          10180: i 2 * j + 200 + cp
        !          10181: LOOP
        !          10182: LOOP
        !          10183: ;
        !          10184: find-disks
        !          10185: ��������21�0fbuffer.fs0 VALUE line#
        !          10186: 0 VALUE column#
        !          10187: false VALUE inverse?
        !          10188: false VALUE inverse-screen?
        !          10189: 18 VALUE #lines
        !          10190: 50 VALUE #columns
        !          10191: false VALUE cursor
        !          10192: false VALUE saved-cursor
        !          10193: defer draw-character   \ 2B inited by display driver
        !          10194: defer reset-screen     \ 2B inited by display driver
        !          10195: defer toggle-cursor    \ 2B inited by display driver
        !          10196: defer erase-screen     \ 2B inited by display driver
        !          10197: defer blink-screen     \ 2B inited by display driver
        !          10198: defer invert-screen    \ 2B inited by display driver
        !          10199: defer insert-characters        \ 2B inited by display driver
        !          10200: defer delete-characters        \ 2B inited by display driver
        !          10201: defer insert-lines     \ 2B inited by display driver
        !          10202: defer delete-lines     \ 2B inited by display driver
        !          10203: defer draw-logo                \ 2B inited by display driver
        !          10204: : nop-toggle-cursor ( nop ) ;
        !          10205: ' nop-toggle-cursor to toggle-cursor
        !          10206: : (cursor-off) ( -- ) cursor dup to saved-cursor
        !          10207: IF toggle-cursor false to cursor THEN ;
        !          10208: : (cursor-on) ( -- ) cursor dup to saved-cursor
        !          10209: 0= IF toggle-cursor true to cursor THEN ;
        !          10210: : restore-cursor ( -- ) saved-cursor dup cursor
        !          10211: <> IF toggle-cursor to cursor ELSE drop THEN ;
        !          10212: ' (cursor-off) to cursor-off
        !          10213: ' (cursor-on) to cursor-on
        !          10214: false VALUE esc-on
        !          10215: false VALUE csi-on
        !          10216: defer esc-process
        !          10217: 0 VALUE esc-num-parm
        !          10218: 0 VALUE esc-num-parm2
        !          10219: 0 VALUE saved-line#
        !          10220: 0 VALUE saved-column#
        !          10221: : get-esc-parm ( default -- value )
        !          10222: esc-num-parm dup 0> IF nip ELSE drop THEN 0 to esc-num-parm ;
        !          10223: : get-esc-parm2 ( default -- value )
        !          10224: esc-num-parm2 dup 0> IF nip ELSE drop THEN 0 to esc-num-parm2 ;
        !          10225: : set-esc-parm ( newdigit -- ) [char] 0 - esc-num-parm a * + to esc-num-parm ;
        !          10226: : reverse-cursor ( oldpos -- newpos) dup IF 1 get-esc-parm - THEN ;
        !          10227: : advance-cursor ( bound oldpos -- newpos) tuck > IF 1 get-esc-parm + THEN ;
        !          10228: : erase-in-line #columns column# - dup 0> IF delete-characters ELSE drop THEN ;
        !          10229: : terminal-line++ ( -- )
        !          10230: line# 1+ dup #lines = IF 1- 0 to line# 1 delete-lines THEN
        !          10231: to line#
        !          10232: ;
        !          10233: 0 VALUE dang
        !          10234: 0 VALUE blipp
        !          10235: : ansi-esc ( char -- )
        !          10236: csi-on IF
        !          10237: dup [char] 0 [char] 9 between IF set-esc-parm
        !          10238: ELSE CASE
        !          10239: [char] A OF line# reverse-cursor to line# ENDOF
        !          10240: [char] B OF #lines line# advance-cursor to line# ENDOF
        !          10241: [char] C OF #columns column# advance-cursor to column# ENDOF
        !          10242: [char] D OF column# reverse-cursor to column# ENDOF
        !          10243: [char] E OF ( FIXME: Cursor Next Line - No idea what does it mean )
        !          10244: #lines line# advance-cursor to line#
        !          10245: ENDOF
        !          10246: [char] f OF
        !          10247: 1 get-esc-parm2 to line# column# get-esc-parm to column#
        !          10248: ENDOF
        !          10249: [char] H OF
        !          10250: 1 get-esc-parm2 to line# column# get-esc-parm to column#
        !          10251: ENDOF
        !          10252: [char] ; OF 0 get-esc-parm to esc-num-parm2 ENDOF
        !          10253: [char] J OF
        !          10254: #lines line# - dup 0> IF
        !          10255: line# 1+ to line# delete-lines line# 1- to line#
        !          10256: ELSE drop THEN
        !          10257: erase-in-line
        !          10258: ENDOF
        !          10259: [char] K OF erase-in-line ENDOF
        !          10260: [char] L OF 1 get-esc-parm insert-lines ENDOF
        !          10261: [char] M OF 1 get-esc-parm delete-lines ENDOF
        !          10262: [char] @ OF 1 get-esc-parm insert-characters ENDOF
        !          10263: [char] P OF 1 get-esc-parm delete-characters ENDOF
        !          10264: [char] m OF 0 get-esc-parm 0<> to inverse? ENDOF
        !          10265: [char] p OF inverse-screen? IF false to inverse-screen?
        !          10266: inverse? 0= to inverse? invert-screen
        !          10267: THEN
        !          10268: ENDOF
        !          10269: [char] q OF inverse-screen? 0= IF true to inverse-screen?
        !          10270: inverse? 0= to inverse? invert-screen
        !          10271: THEN
        !          10272: ENDOF
        !          10273: [char] u OF saved-line# to line# saved-column# to column# ENDOF
        !          10274: dup dup to dang OF blink-screen ENDOF
        !          10275: ENDCASE false to csi-on
        !          10276: false to esc-on 0 to esc-num-parm 0 to esc-num-parm2
        !          10277: THEN
        !          10278: ELSE CASE
        !          10279: [char] 7 OF line# to saved-line# column# to saved-column# ENDOF
        !          10280: [char] 8 OF saved-line# to line# saved-column# to column# ENDOF
        !          10281: [char] [ OF true to csi-on ENDOF
        !          10282: dup dup OF false to esc-on to blipp ENDOF
        !          10283: ENDCASE
        !          10284: csi-on 0= IF false to esc-on THEN 0 to esc-num-parm 0 to esc-num-parm2
        !          10285: THEN
        !          10286: ;
        !          10287: ' ansi-esc to esc-process
        !          10288: CREATE twtracebuf 4000 allot twtracebuf 4000 erase
        !          10289: twtracebuf VALUE twbp
        !          10290: 0 VALUE twbc
        !          10291: : twtrace
        !          10292: twbc 4000 = IF 0 to twbc twtracebuf to twbp THEN
        !          10293: dup twbp c! twbp 1+ to twbp twbc 1+ to twbc
        !          10294: ;
        !          10295: : terminal-write ( addr len -- actual-len )
        !          10296: cursor-off
        !          10297: tuck bounds ?DO i c@
        !          10298: twtrace
        !          10299: esc-on IF esc-process
        !          10300: ELSE CASE
        !          10301: 1B OF true to esc-on ENDOF
        !          10302: carret OF 0 to column# ENDOF
        !          10303: linefeed OF terminal-line++ ENDOF
        !          10304: bell OF blink-screen ENDOF
        !          10305: 9 ( TAB ) OF column# 7 + -8 and dup #columns < IF
        !          10306: to column#
        !          10307: ELSE drop THEN
        !          10308: ENDOF
        !          10309: B ( VT ) OF line# ?dup IF 1- to line# THEN ENDOF
        !          10310: C ( FF ) OF 0 to line# 0 to column# erase-screen ENDOF
        !          10311: bs OF  column# 1- dup 0< IF
        !          10312: line# IF
        !          10313: line# 1- to line#
        !          10314: drop #columns 1-
        !          10315: ELSE drop column#
        !          10316: THEN
        !          10317: THEN
        !          10318: to column# ( bl draw-character )
        !          10319: ENDOF
        !          10320: dup OF
        !          10321: i c@ draw-character
        !          10322: column# 1+ dup #columns >= IF
        !          10323: drop 0 terminal-line++
        !          10324: THEN
        !          10325: to column#
        !          10326: ENDOF
        !          10327: ENDCASE
        !          10328: THEN
        !          10329: LOOP
        !          10330: restore-cursor
        !          10331: ;
        !          10332: 0 VALUE char-height
        !          10333: 0 VALUE char-width
        !          10334: 0 VALUE fontbytes
        !          10335: CREATE display-emit-buffer 20 allot
        !          10336: defer dis-old-emit
        !          10337: ' emit behavior to dis-old-emit
        !          10338: : display-write terminal-write ;
        !          10339: : display-emit dup dis-old-emit display-emit-buffer tuck c! 1 terminal-write drop ;
        !          10340: : is-install ( 'open -- )
        !          10341: s" defer vendor-open to vendor-open" eval
        !          10342: s" : open deadbeef vendor-open dup deadbeef = IF drop true ELSE nip THEN ;" eval
        !          10343: s" defer write ' display-write to write" eval
        !          10344: s" : draw-logo ['] draw-logo CATCH IF 2drop 2drop THEN ;" eval
        !          10345: s" : reset-screen ['] reset-screen CATCH drop ;" eval
        !          10346: ;
        !          10347: : is-remove ( 'close -- )
        !          10348: s" defer close to close" eval
        !          10349: ;
        !          10350: : is-selftest ( 'selftest -- )
        !          10351: s" defer selftest to selftest" eval
        !          10352: ;
        !          10353: STRUCT
        !          10354: cell FIELD font>addr
        !          10355: cell FIELD font>width
        !          10356: cell FIELD font>height
        !          10357: cell FIELD font>advance
        !          10358: cell FIELD font>min-char
        !          10359: cell FIELD font>#glyphs
        !          10360: CONSTANT /font
        !          10361: CREATE default-font-ctrblk /font allot default-font-ctrblk
        !          10362: dup font>addr 0 swap !
        !          10363: dup font>width 8 swap !
        !          10364: dup font>height -10 swap !
        !          10365: dup font>advance 1 swap !
        !          10366: dup font>min-char 20 swap !
        !          10367: font>#glyphs 7f swap !
        !          10368: : display-default-font ( str len -- )
        !          10369: romfs-lookup dup 0= IF drop EXIT THEN
        !          10370: 600 <> IF ." Only support 60x8x16 fonts ! " drop EXIT THEN
        !          10371: default-font-ctrblk font>addr !
        !          10372: ;
        !          10373: s" default-font.bin" display-default-font
        !          10374: : .scan-lines ( height -- scanlines ) dup 0>= IF 1- ELSE negate THEN ;
        !          10375: : set-font ( addr width height advance min-char #glyphs -- )
        !          10376: default-font-ctrblk /font + /font 0
        !          10377: DO
        !          10378: 1 cells - dup >r ! r> 1 cells
        !          10379: +LOOP drop
        !          10380: default-font-ctrblk dup font>height @ abs to char-height
        !          10381: dup font>width @ to char-width font>advance @ to fontbytes
        !          10382: ;
        !          10383: : >font ( char -- addr )
        !          10384: dup default-font-ctrblk dup >r font>min-char @ dup r@ font>#glyphs + within
        !          10385: IF
        !          10386: r@ font>min-char @ -
        !          10387: r@ font>advance @ * r@ font>height @ .scan-lines *
        !          10388: r> font>addr @ +
        !          10389: ELSE
        !          10390: drop r> font>addr @
        !          10391: THEN
        !          10392: ;
        !          10393: : default-font ( -- addr width height advance min-char #glyphs )
        !          10394: default-font-ctrblk /font 0 DO dup cell+ >r @ r> 1 cells +LOOP drop
        !          10395: ;
        !          10396: 0 VALUE frame-buffer-adr
        !          10397: 0 VALUE screen-height
        !          10398: 0 VALUE screen-width
        !          10399: 0 VALUE screen-depth
        !          10400: 0 VALUE window-top
        !          10401: 0 VALUE window-left
        !          10402: 0 VALUE .sc
        !          10403: : screen-#rows  ( -- rows )
        !          10404: .sc IF
        !          10405: screen-height char-height /
        !          10406: ELSE
        !          10407: true to .sc
        !          10408: s" screen-#rows" eval
        !          10409: false to .sc
        !          10410: THEN
        !          10411: ;
        !          10412: : screen-#columns ( -- columns )
        !          10413: .sc IF
        !          10414: screen-width char-width /
        !          10415: ELSE
        !          10416: true to .sc
        !          10417: s" screen-#columns" eval
        !          10418: false to .sc
        !          10419: THEN
        !          10420: ;
        !          10421: : fb8-background inverse-screen? ;
        !          10422: : fb8-foreground inverse? invert ;
        !          10423: : fb8-lines2bytes ( #lines -- #bytes ) char-height * screen-width * screen-depth * ;
        !          10424: : fb8-columns2bytes ( #columns -- #bytes ) char-width * screen-depth * ;
        !          10425: : fb8-line2addr ( line# -- addr )
        !          10426: char-height * window-top + screen-width * screen-depth *
        !          10427: frame-buffer-adr + window-left screen-depth * +
        !          10428: ;
        !          10429: : fb8-erase-block ( addr len ) fb8-background rfill ;
        !          10430: 0 VALUE .ab
        !          10431: CREATE bitmap-buffer 400 4 * allot
        !          10432: : active-bits ( -- new ) .ab dup 8 > IF 8 - to .ab 8 ELSE
        !          10433: char-width to .ab ?dup 0= IF recurse THEN
        !          10434: THEN ;
        !          10435: : fb8-char2bitmap ( font-height font-addr -- bitmap-buffer )
        !          10436: bitmap-buffer >r
        !          10437: char-height rot 0> IF r> char-width 2dup fb8-erase-block + >r 1- THEN
        !          10438: r> -rot char-width to .ab
        !          10439: fontbytes * bounds ?DO
        !          10440: i c@ active-bits 0 ?DO
        !          10441: dup 80 and IF fb8-foreground ELSE fb8-background THEN
        !          10442: ( fb-addr fbyte colr ) 2 pick ! 1 lshift
        !          10443: swap screen-depth + swap
        !          10444: LOOP drop
        !          10445: LOOP drop
        !          10446: bitmap-buffer
        !          10447: ;
        !          10448: : fb8-draw-logo ( line# addr width height -- ) ." fb8-draw-logo ( " .s ."  )" cr
        !          10449: 2drop 2drop
        !          10450: ;
        !          10451: : fb8-toggle-cursor ( -- )
        !          10452: line# fb8-line2addr column# fb8-columns2bytes +
        !          10453: char-height 0 ?DO
        !          10454: char-width screen-depth * 0 ?DO dup dup rb@ -1 xor swap rb! 1+ LOOP
        !          10455: screen-width screen-depth * + char-width screen-depth * -
        !          10456: LOOP drop
        !          10457: ;
        !          10458: : fb8-draw-character ( char -- )
        !          10459: >r default-font over + r@ -rot between IF
        !          10460: 2swap 3drop r> >font fb8-char2bitmap ( bitmap-buf )
        !          10461: line# fb8-line2addr column# fb8-columns2bytes + ( bitmap-buf fb-addr )
        !          10462: char-height 0 ?DO
        !          10463: 2dup char-width screen-depth * mrmove
        !          10464: screen-width screen-depth * + >r char-width screen-depth * + r>
        !          10465: LOOP 2drop
        !          10466: ELSE 2drop r> 3drop THEN
        !          10467: ;
        !          10468: : fb8-insert-lines ( n -- )
        !          10469: fb8-lines2bytes >r line# fb8-line2addr dup dup r@ +
        !          10470: #lines line# - fb8-lines2bytes r@ - rmove
        !          10471: r> fb8-erase-block
        !          10472: ;
        !          10473: : fb8-delete-lines ( n -- )
        !          10474: fb8-lines2bytes >r line# fb8-line2addr dup dup r@ + swap
        !          10475: #lines fb8-lines2bytes r@ - dup >r rmove
        !          10476: r> + r> fb8-erase-block
        !          10477: ;
        !          10478: : fb8-insert-characters ( n -- )
        !          10479: line# fb8-line2addr column# fb8-columns2bytes + >r
        !          10480: #columns column# - 2dup >= IF
        !          10481: nip dup 0> IF fb8-columns2bytes r> ELSE r> 2drop EXIT THEN
        !          10482: ELSE
        !          10483: fb8-columns2bytes swap fb8-columns2bytes tuck -
        !          10484: over r@ tuck + rot char-height 0 ?DO
        !          10485: 3dup rmove
        !          10486: -rot screen-width screen-depth * tuck + -rot + swap rot
        !          10487: LOOP
        !          10488: 3drop r>
        !          10489: THEN
        !          10490: char-height 0 ?DO
        !          10491: dup 2 pick fb8-erase-block screen-width screen-depth * +
        !          10492: LOOP
        !          10493: 2drop
        !          10494: ;
        !          10495: : fb8-delete-characters ( n -- )
        !          10496: line# fb8-line2addr column# fb8-columns2bytes + >r
        !          10497: #columns column# - 2dup >= IF
        !          10498: nip dup 0> IF fb8-columns2bytes r> ELSE r> 2drop EXIT THEN
        !          10499: ELSE
        !          10500: fb8-columns2bytes swap fb8-columns2bytes tuck -
        !          10501: over r@ + 2dup + r> swap >r rot char-height 0 ?DO
        !          10502: 3dup rmove
        !          10503: -rot screen-width screen-depth * tuck + -rot + swap rot
        !          10504: LOOP
        !          10505: 3drop r> over -
        !          10506: THEN
        !          10507: char-height 0 ?DO
        !          10508: dup 2 pick fb8-erase-block screen-width screen-depth * +
        !          10509: LOOP
        !          10510: 2drop
        !          10511: ;
        !          10512: : fb8-reset-screen ( -- ) ( Left as no-op by design ) ;
        !          10513: : fb8-erase-screen ( -- )
        !          10514: frame-buffer-adr screen-height screen-width * screen-depth * fb8-erase-block
        !          10515: ;
        !          10516: : fb8-invert-screen ( -- )
        !          10517: frame-buffer-adr screen-height screen-width * screen-depth * 2dup /x / 0 ?DO
        !          10518: dup rx@ -1 xor over rx! xa1+
        !          10519: LOOP 3drop
        !          10520: ;
        !          10521: : fb8-blink-screen ( -- ) fb8-invert-screen fb8-invert-screen ;
        !          10522: : fb8-install ( width height #columns #lines -- )
        !          10523: 1 to screen-depth
        !          10524: 2swap  to screen-height  to screen-width
        !          10525: screen-#rows min to #lines
        !          10526: screen-#columns min to #columns
        !          10527: screen-height char-height #lines * - 2/ to window-top
        !          10528: screen-width char-width #columns * - 2/ to window-left
        !          10529: ['] fb8-toggle-cursor to toggle-cursor
        !          10530: ['] fb8-draw-character to draw-character
        !          10531: ['] fb8-insert-lines to insert-lines
        !          10532: ['] fb8-delete-lines to delete-lines
        !          10533: ['] fb8-insert-characters to insert-characters
        !          10534: ['] fb8-delete-characters to delete-characters
        !          10535: ['] fb8-erase-screen to erase-screen
        !          10536: ['] fb8-blink-screen to blink-screen
        !          10537: ['] fb8-invert-screen to invert-screen
        !          10538: ['] fb8-reset-screen to reset-screen
        !          10539: ['] fb8-draw-logo to draw-logo
        !          10540: ;
        !          10541: : fb-install  ( width height #columns #lines depth -- )
        !          10542: >r
        !          10543: fb8-install
        !          10544: r> to screen-depth
        !          10545: ;
        !          10546: : fb8-set-tokens  ( -- )
        !          10547: ['] is-install        0 11C set-token
        !          10548: ['] is-remove         0 11D set-token
        !          10549: ['] is-selftest       0 11E set-token
        !          10550: ['] #lines            0 150 set-token
        !          10551: ['] #columns          0 151 set-token
        !          10552: ['] line#             0 152 set-token
        !          10553: ['] column#           0 153 set-token
        !          10554: ['] inverse?          0 154 set-token
        !          10555: ['] inverse-screen?   0 155 set-token
        !          10556: ['] draw-character    0 157 set-token
        !          10557: ['] reset-screen      0 158 set-token
        !          10558: ['] toggle-cursor     0 159 set-token
        !          10559: ['] erase-screen      0 15A set-token
        !          10560: ['] blink-screen      0 15B set-token
        !          10561: ['] invert-screen     0 15C set-token
        !          10562: ['] insert-characters 0 15D set-token
        !          10563: ['] delete-characters 0 15E set-token
        !          10564: ['] insert-lines      0 15F set-token
        !          10565: ['] delete-lines      0 160 set-token
        !          10566: ['] draw-logo         0 161 set-token
        !          10567: ['] frame-buffer-adr  0 162 set-token
        !          10568: ['] screen-height     0 163 set-token
        !          10569: ['] screen-width      0 164 set-token
        !          10570: ['] window-top        0 165 set-token
        !          10571: ['] window-left       0 166 set-token
        !          10572: ['] default-font      0 16A set-token
        !          10573: ['] set-font          0 16B set-token
        !          10574: ['] char-height       0 16C set-token
        !          10575: ['] char-width        0 16D set-token
        !          10576: ['] >font             0 16E set-token
        !          10577: ['] fontbytes         0 16F set-token
        !          10578: ['] fb8-draw-character    0 180 set-token
        !          10579: ['] fb8-reset-screen      0 181 set-token
        !          10580: ['] fb8-toggle-cursor     0 182 set-token
        !          10581: ['] fb8-erase-screen      0 183 set-token
        !          10582: ['] fb8-blink-screen      0 184 set-token
        !          10583: ['] fb8-invert-screen     0 185 set-token
        !          10584: ['] fb8-insert-characters 0 186 set-token
        !          10585: ['] fb8-delete-characters 0 187 set-token
        !          10586: ['] fb8-insert-lines      0 188 set-token
        !          10587: ['] fb8-delete-lines      0 189 set-token
        !          10588: ['] fb8-draw-logo         0 18A set-token
        !          10589: ['] fb8-install           0 18B set-token
        !          10590: ;
        !          10591: fb8-set-tokens
        !          10592: : fb8-dump-bitmap cr char-height 0 ?do char-width 0 ?do dup c@ if ." @" else ." ." then 1+ loop cr loop drop ;
        !          10593: : fb8-dump-char >font -b swap fb8-char2bitmap fb8-dump-bitmap ;
        !          10594: ���������0generic-disk.fsnew-device set-unit                                          ( str len )
        !          10595: 2dup device-name 
        !          10596: s" 0 pci-alias-" 2swap $cat evaluate
        !          10597: s" block" device-type      
        !          10598: s" block-size" $call-parent   CONSTANT block-size
        !          10599: s" max-transfer" $call-parent CONSTANT max-transfer 
        !          10600: : read-blocks ( addr block# #blocks -- #read )
        !          10601: my-unit s" dev-read-blocks" $call-parent
        !          10602: ;    
        !          10603: INSTANCE VARIABLE deblocker
        !          10604: : open ( -- okay? )
        !          10605: 0 0 s" deblocker" $open-package dup deblocker ! dup IF 
        !          10606: s" disk-label" find-package IF
        !          10607: my-args rot interpose
        !          10608: THEN
        !          10609: THEN 0<> ;
        !          10610: : close ( -- )
        !          10611: deblocker @ close-package ;
        !          10612: : seek ( pos.lo pos.hi -- status )
        !          10613: s" seek" deblocker @ $call-method ;
        !          10614: : read ( addr len -- actual )
        !          10615: s" read" deblocker @ $call-method ;
        !          10616: finish-device
        !          10617: ���������W0pci-device.fsget-node CONSTANT my-phandle
        !          10618: s" my-puid" my-phandle parent $call-static CONSTANT my-puid
        !          10619: : config-b@  puid >r my-puid TO puid my-space + rtas-config-b@ r> TO puid ;
        !          10620: : config-w@  puid >r my-puid TO puid my-space + rtas-config-w@ r> TO puid ;
        !          10621: : config-l@  puid >r my-puid TO puid my-space + rtas-config-l@ r> TO puid ;
        !          10622: : config-b!  puid >r my-puid TO puid my-space + rtas-config-b! r> TO puid ;
        !          10623: : config-w!  puid >r my-puid TO puid my-space + rtas-config-w! r> TO puid ;
        !          10624: : config-l!  puid >r my-puid TO puid my-space + rtas-config-l! r> TO puid ;
        !          10625: : config-dump puid >r my-puid TO puid my-space pci-dump r> TO puid ;
        !          10626: : open
        !          10627: puid >r             \ save the old puid
        !          10628: my-puid TO puid     \ set up the puid to the devices Hostbridge
        !          10629: pci-master-enable   \ And enable Bus Master, IO and MEM access again.
        !          10630: pci-mem-enable      \ enable mem access
        !          10631: pci-io-enable       \ enable io access
        !          10632: r> TO puid          \ restore puid
        !          10633: true
        !          10634: ;
        !          10635: : close 
        !          10636: puid >r             \ save the old puid
        !          10637: my-puid TO puid     \ set up the puid
        !          10638: pci-device-disable  \ and disable the device
        !          10639: r> TO puid          \ restore puid
        !          10640: ;
        !          10641: : dma-alloc ( size -- virt )
        !          10642: my-phandle TO calling-child
        !          10643: s" dma-alloc" my-phandle parent $call-static
        !          10644: 0 TO calling-child
        !          10645: ;
        !          10646: : dma-free ( virt size -- )
        !          10647: my-phandle TO calling-child
        !          10648: s" dma-free" my-phandle parent $call-static
        !          10649: 0 TO calling-child
        !          10650: ;
        !          10651: : dma-map-in ( virt size cacheable? -- devaddr )
        !          10652: my-phandle TO calling-child
        !          10653: s" dma-map-in" my-phandle parent $call-static
        !          10654: 0 TO calling-child
        !          10655: ;
        !          10656: : dma-map-out ( virt devaddr size -- )
        !          10657: my-phandle TO calling-child
        !          10658: s" dma-map-out" my-phandle parent $call-static
        !          10659: 0 TO calling-child
        !          10660: ;
        !          10661: : devicefile ( -- str len )
        !          10662: s" pci-device_"
        !          10663: my-space pci-vendor@ 4 int2str $cat
        !          10664: s" _" $cat
        !          10665: my-space pci-device@ 4 int2str $cat
        !          10666: s" .fs" $cat
        !          10667: ;
        !          10668: : classfile ( -- str len )
        !          10669: s" pci-class_"
        !          10670: my-space pci-class@ 10 rshift 2 int2str $cat
        !          10671: s" .fs" $cat
        !          10672: ;
        !          10673: : setup ( -- )
        !          10674: devicefile romfs-lookup ?dup
        !          10675: IF
        !          10676: evaluate
        !          10677: ELSE
        !          10678: classfile romfs-lookup ?dup
        !          10679: IF
        !          10680: evaluate
        !          10681: ELSE
        !          10682: my-space pci-class-name type 2a emit cr
        !          10683: my-space pci-device-generic-setup
        !          10684: THEN
        !          10685: THEN
        !          10686: ;
        !          10687: pci-device-disable
        !          10688: pci-error-enable
        !          10689: my-space 44 pci-out     \ config-addr ascii('D')
        !          10690: setup
        !          10691: ��������`'0pci-bridge.fss" my-puid" $call-parent CONSTANT my-puid
        !          10692: pci-bus-number 1+ CONSTANT my-bus
        !          10693: s" pci-config-bridge.fs" included
        !          10694: : filename ( -- str len )
        !          10695: s" pci-bridge_"
        !          10696: my-space pci-vendor@ 4 int2str $cat
        !          10697: s" _" $cat
        !          10698: my-space pci-device@ 4 int2str $cat
        !          10699: s" .fs" $cat
        !          10700: ;
        !          10701: : setup ( -- )
        !          10702: filename romfs-lookup ?dup
        !          10703: IF
        !          10704: evaluate
        !          10705: ELSE
        !          10706: my-space pci-class-name type 2a emit cr
        !          10707: my-space pci-bridge-generic-setup
        !          10708: my-space pci-reset-2nd
        !          10709: THEN
        !          10710: ;
        !          10711: pci-device-disable
        !          10712: pci-error-enable
        !          10713: my-space 42 pci-out     \ config-addr ascii('B')
        !          10714: setup
        !          10715: pci-master-enable
        !          10716: pci-mem-enable
        !          10717: pci-io-enable
        !          10718: �����������O8pci-properties.fs: pci-class-name-00 ( addr -- str len )
        !          10719: pci-class@ 8 rshift FF and CASE
        !          10720: 01  OF s" display"               ENDOF
        !          10721: dup OF s" unknown-legacy-device" ENDOF
        !          10722: ENDCASE
        !          10723: ;
        !          10724: : pci-class-name-01 ( addr -- str len )
        !          10725: pci-class@ 8 rshift FF and CASE
        !          10726: 00  OF s" scsi"         ENDOF
        !          10727: 01  OF s" ide"          ENDOF
        !          10728: 02  OF s" fdc"          ENDOF
        !          10729: 03  OF s" ipi"          ENDOF
        !          10730: 04  OF s" raid"         ENDOF
        !          10731: 05  OF s" ata"          ENDOF
        !          10732: 06  OF s" sata"         ENDOF
        !          10733: 07  OF s" sas"          ENDOF
        !          10734: dup OF s" mass-storage" ENDOF
        !          10735: ENDCASE
        !          10736: ;
        !          10737: : pci-class-name-02 ( addr -- str len )
        !          10738: pci-class@ 8 rshift FF and CASE
        !          10739: 00  OF s" ethernet"   ENDOF
        !          10740: 01  OF s" token-ring" ENDOF
        !          10741: 02  OF s" fddi"       ENDOF
        !          10742: 03  OF s" atm"        ENDOF
        !          10743: 04  OF s" isdn"       ENDOF
        !          10744: 05  OF s" worldfip"   ENDOF
        !          10745: 05  OF s" picmg"      ENDOF
        !          10746: dup OF s" network"    ENDOF
        !          10747: ENDCASE
        !          10748: ;
        !          10749: : pci-class-name-03 ( addr -- str len )
        !          10750: pci-class@ FFFF and CASE
        !          10751: 0000  OF s" vga"             ENDOF
        !          10752: 0001  OF s" 8514-compatible" ENDOF
        !          10753: 0100  OF s" xga"             ENDOF
        !          10754: 0200  OF s" 3d-controller"   ENDOF
        !          10755: dup OF s" display"           ENDOF
        !          10756: ENDCASE
        !          10757: ;
        !          10758: : pci-class-name-04 ( addr -- str len )
        !          10759: pci-class@ 8 rshift FF and CASE
        !          10760: 00  OF s" video"             ENDOF
        !          10761: 01  OF s" sound"             ENDOF
        !          10762: 02  OF s" telephony"         ENDOF
        !          10763: dup OF s" multimedia-device" ENDOF
        !          10764: ENDCASE
        !          10765: ;
        !          10766: : pci-class-name-05 ( addr -- str len )
        !          10767: pci-class@ 8 rshift FF and CASE
        !          10768: 00  OF s" memory"            ENDOF
        !          10769: 01  OF s" flash"             ENDOF
        !          10770: dup OF s" memory-controller" ENDOF
        !          10771: ENDCASE
        !          10772: ;
        !          10773: : pci-class-name-06 ( addr -- str len )
        !          10774: pci-class@ 8 rshift FF and CASE
        !          10775: 00  OF s" host"                 ENDOF
        !          10776: 01  OF s" isa"                  ENDOF
        !          10777: 02  OF s" eisa"                 ENDOF
        !          10778: 03  OF s" mca"                  ENDOF
        !          10779: 04  OF s" pci"                  ENDOF
        !          10780: 05  OF s" pcmcia"               ENDOF
        !          10781: 06  OF s" nubus"                ENDOF
        !          10782: 07  OF s" cardbus"              ENDOF
        !          10783: 08  OF s" raceway"              ENDOF
        !          10784: 09  OF s" semi-transparent-pci" ENDOF
        !          10785: 0A  OF s" infiniband"           ENDOF
        !          10786: dup OF s" unkown-bridge"        ENDOF
        !          10787: ENDCASE
        !          10788: ;
        !          10789: : pci-class-name-07 ( addr -- str len )
        !          10790: pci-class@ FFFF and CASE
        !          10791: 0000  OF s" serial"                   ENDOF
        !          10792: 0001  OF s" 16450-serial"             ENDOF
        !          10793: 0002  OF s" 16550-serial"             ENDOF
        !          10794: 0003  OF s" 16650-serial"             ENDOF
        !          10795: 0004  OF s" 16750-serial"             ENDOF
        !          10796: 0005  OF s" 16850-serial"             ENDOF
        !          10797: 0006  OF s" 16950-serial"             ENDOF
        !          10798: 0100  OF s" parallel"                 ENDOF
        !          10799: 0101  OF s" bi-directional-parallel"  ENDOF
        !          10800: 0102  OF s" ecp-1.x-parallel"         ENDOF
        !          10801: 0103  OF s" ieee1284-controller"      ENDOF
        !          10802: 01FE  OF s" ieee1284-device"          ENDOF
        !          10803: 0200  OF s" multiport-serial"         ENDOF
        !          10804: 0300  OF s" modem"                    ENDOF
        !          10805: 0301  OF s" 16450-modem"              ENDOF
        !          10806: 0302  OF s" 16550-modem"              ENDOF
        !          10807: 0303  OF s" 16650-modem"              ENDOF
        !          10808: 0304  OF s" 16750-modem"              ENDOF
        !          10809: 0400  OF s" gpib"                     ENDOF
        !          10810: 0500  OF s" smart-card"               ENDOF
        !          10811: dup   OF s" communication-controller" ENDOF
        !          10812: ENDCASE
        !          10813: ;
        !          10814: : pci-class-name-08 ( addr -- str len )
        !          10815: pci-class@ FFFF and CASE
        !          10816: 0000  OF s" interrupt-controller" ENDOF
        !          10817: 0001  OF s" isa-pic"              ENDOF
        !          10818: 0002  OF s" eisa-pic"             ENDOF
        !          10819: 0010  OF s" io-apic"              ENDOF
        !          10820: 0020  OF s" iox-apic"             ENDOF
        !          10821: 0100  OF s" dma-controller"       ENDOF
        !          10822: 0101  OF s" isa-dma"              ENDOF
        !          10823: 0102  OF s" eisa-dma"             ENDOF
        !          10824: 0200  OF s" timer"                ENDOF
        !          10825: 0201  OF s" isa-system-timer"     ENDOF
        !          10826: 0202  OF s" eisa-system-timer"    ENDOF
        !          10827: 0300  OF s" rtc"                  ENDOF
        !          10828: 0301  OF s" isa-rtc"              ENDOF
        !          10829: 0400  OF s" hot-plug-controller"  ENDOF
        !          10830: 0500  OF s" sd-host-conrtoller"   ENDOF
        !          10831: dup   OF s" system-periphal"      ENDOF
        !          10832: ENDCASE
        !          10833: ;
        !          10834: : pci-class-name-09 ( addr -- str len )
        !          10835: pci-class@ 8 rshift FF and CASE
        !          10836: 00  OF s" keyboard"         ENDOF
        !          10837: 01  OF s" pen"              ENDOF
        !          10838: 02  OF s" mouse"            ENDOF
        !          10839: 03  OF s" scanner"          ENDOF
        !          10840: 04  OF s" gameport"         ENDOF
        !          10841: dup OF s" input-controller" ENDOF
        !          10842: ENDCASE
        !          10843: ;
        !          10844: : pci-class-name-0A ( addr -- str len )
        !          10845: pci-class@ 8 rshift FF and CASE
        !          10846: 00  OF s" dock"            ENDOF
        !          10847: dup OF s" docking-station" ENDOF
        !          10848: ENDCASE
        !          10849: ;
        !          10850: : pci-class-name-0B ( addr -- str len )
        !          10851: pci-class@ 8 rshift FF and CASE
        !          10852: 00  OF s" 386"           ENDOF
        !          10853: 01  OF s" 486"           ENDOF
        !          10854: 02  OF s" pentium"       ENDOF
        !          10855: 10  OF s" alpha"         ENDOF
        !          10856: 20  OF s" powerpc"       ENDOF
        !          10857: 30  OF s" mips"          ENDOF
        !          10858: 40  OF s" co-processor"  ENDOF
        !          10859: dup OF s" cpu"           ENDOF
        !          10860: ENDCASE
        !          10861: ;
        !          10862: : pci-class-name-0C ( addr -- str len )
        !          10863: pci-class@ FFFF and CASE
        !          10864: 0000  OF s" firewire"      ENDOF
        !          10865: 0100  OF s" access-bus"    ENDOF
        !          10866: 0200  OF s" ssa"           ENDOF
        !          10867: 0300  OF s" usb-uhci"      ENDOF
        !          10868: 0310  OF s" usb-ohci"      ENDOF
        !          10869: 0320  OF s" usb-ehci"      ENDOF
        !          10870: 0380  OF s" usb"           ENDOF
        !          10871: 03FE  OF s" usb-device"    ENDOF
        !          10872: 0400  OF s" fibre-channel" ENDOF
        !          10873: 0500  OF s" smb"           ENDOF
        !          10874: 0600  OF s" infiniband"    ENDOF
        !          10875: 0700  OF s" ipmi-smic"     ENDOF
        !          10876: 0701  OF s" ipmi-kbrd"     ENDOF
        !          10877: 0702  OF s" ipmi-bltr"     ENDOF
        !          10878: 0800  OF s" sercos"        ENDOF
        !          10879: 0900  OF s" canbus"        ENDOF
        !          10880: dup OF s" serial-bus"      ENDOF
        !          10881: ENDCASE
        !          10882: ;
        !          10883: : pci-class-name-0D ( addr -- str len )
        !          10884: pci-class@ 8 rshift FF and CASE
        !          10885: 00  OF s" irda"                ENDOF
        !          10886: 01  OF s" consumer-ir"         ENDOF
        !          10887: 10  OF s" rf-controller"       ENDOF
        !          10888: 11  OF s" bluetooth"           ENDOF
        !          10889: 12  OF s" broadband"           ENDOF
        !          10890: 20  OF s" enet-802.11a"        ENDOF
        !          10891: 21  OF s" enet-802.11b"        ENDOF
        !          10892: dup OF s" wireless-controller" ENDOF
        !          10893: ENDCASE
        !          10894: ;
        !          10895: : pci-class-name-0E ( addr -- str len )
        !          10896: pci-class@ 8 rshift FF and CASE
        !          10897: dup OF s" intelligent-io" ENDOF
        !          10898: ENDCASE
        !          10899: ;
        !          10900: : pci-class-name-0F ( addr -- str len )
        !          10901: pci-class@ 8 rshift FF and CASE
        !          10902: 01  OF s" satelite-tv"     ENDOF
        !          10903: 02  OF s" satelite-audio"  ENDOF
        !          10904: 03  OF s" satelite-voice"  ENDOF
        !          10905: 04  OF s" satelite-data"   ENDOF
        !          10906: dup OF s" satelite-devoce" ENDOF
        !          10907: ENDCASE
        !          10908: ;
        !          10909: : pci-class-name-10 ( addr -- str len )
        !          10910: pci-class@ 8 rshift FF and CASE
        !          10911: 00  OF s" network-encryption"       ENDOF
        !          10912: 01  OF s" entertainment-encryption" ENDOF
        !          10913: dup OF s" encryption"               ENDOF
        !          10914: ENDCASE
        !          10915: ;
        !          10916: : pci-class-name-11 ( addr -- str len )
        !          10917: pci-class@ 8 rshift FF and CASE
        !          10918: 00  OF s" dpio"                       ENDOF
        !          10919: 01  OF s" counter"                    ENDOF
        !          10920: 10  OF s" measurement"                ENDOF
        !          10921: 20  OF s" managment-card"             ENDOF
        !          10922: dup OF s" data-processing-controller" ENDOF
        !          10923: ENDCASE
        !          10924: ;
        !          10925: : pci-class-name ( addr -- str len )
        !          10926: dup pci-class@ 10 rshift CASE
        !          10927: 00  OF pci-class-name-00 ENDOF
        !          10928: 01  OF pci-class-name-01 ENDOF
        !          10929: 02  OF pci-class-name-02 ENDOF
        !          10930: 03  OF pci-class-name-03 ENDOF
        !          10931: 04  OF pci-class-name-04 ENDOF
        !          10932: 05  OF pci-class-name-05 ENDOF
        !          10933: 06  OF pci-class-name-06 ENDOF
        !          10934: 07  OF pci-class-name-07 ENDOF
        !          10935: 08  OF pci-class-name-08 ENDOF
        !          10936: 09  OF pci-class-name-09 ENDOF
        !          10937: 0A  OF pci-class-name-0A ENDOF
        !          10938: 0B  OF pci-class-name-0B ENDOF
        !          10939: 0C  OF pci-class-name-0C ENDOF
        !          10940: 0C  OF pci-class-name-0D ENDOF
        !          10941: 0C  OF pci-class-name-0E ENDOF
        !          10942: 0C  OF pci-class-name-0F ENDOF
        !          10943: 0C  OF pci-class-name-10 ENDOF
        !          10944: 0C  OF pci-class-name-11 ENDOF
        !          10945: dup OF drop s" unknown"  ENDOF
        !          10946: ENDCASE
        !          10947: ;
        !          10948: : pci-bar-size@     ( bar-addr -- bar-size ) -1 over rtas-config-l! rtas-config-l@ ;
        !          10949: : pci-bar-size-mem@ ( bar-addr -- mem-size ) pci-bar-size@ -10 and invert 1+ FFFFFFFF and ;
        !          10950: : pci-bar-size-io@  ( bar-addr -- io-size  ) pci-bar-size@ -4 and invert 1+ FFFFFFFF and ;
        !          10951: : pci-bar-size ( bar-addr -- bar-size-raw )
        !          10952: dup rtas-config-l@ swap \ fetch original Value  ( bval baddr )
        !          10953: -1 over rtas-config-l!  \ make BAR show size    ( bval baddr )
        !          10954: dup rtas-config-l@      \ and fetch the size    ( bval baddr bsize )
        !          10955: -rot rtas-config-l!     \ restore Value
        !          10956: ;
        !          10957: : pci-bar-size-mem32 ( bar-addr -- bar-size )
        !          10958: pci-bar-size            \ fetch raw size
        !          10959: -10 and invert 1+       \ calc size
        !          10960: FFFFFFFF and            \ keep lower 32 bits
        !          10961: ;
        !          10962: : pci-bar-size-rom ( bar-addr -- bar-size )
        !          10963: pci-bar-size            \ fetch raw size
        !          10964: FFFFF800 and invert 1+  \ calc size
        !          10965: FFFFFFFF and            \ keep lower 32 bits
        !          10966: ;
        !          10967: : pci-bar-size-mem64 ( bar-addr -- bar-size )
        !          10968: dup pci-bar-size        \ fetch raw size lower 32 bits
        !          10969: swap 4 + pci-bar-size   \ fetch raw size upper 32 bits
        !          10970: 20 lshift +             \ and put them together
        !          10971: -10 and invert 1+       \ calc size
        !          10972: ;
        !          10973: : pci-bar-size-io ( bar-addr -- bar-size )
        !          10974: pci-bar-size            \ fetch raw size
        !          10975: -4 and invert 1+        \ calc size
        !          10976: FFFFFFFF and            \ keep lower 32 bits
        !          10977: ;
        !          10978: : pci-bar-code@ ( bar-addr -- 0|1..4|5 )
        !          10979: rtas-config-l@ dup                \ fetch the BaseAddressRegister
        !          10980: 1 and IF                          \ IO BAR ?
        !          10981: 2 and IF 0 ELSE 1 THEN    \ only '01' is valid
        !          10982: ELSE                              \ Memory BAR ?
        !          10983: F and CASE
        !          10984: 0   OF 2 ENDOF    \ Memory 32 Bit Non-Prefetchable
        !          10985: 8   OF 3 ENDOF    \ Memory 32 Bit Prefetchable
        !          10986: 4   OF 4 ENDOF    \ Memory 64 Bit Non-Prefetchable
        !          10987: C   OF 5 ENDOF    \ Memory 64 Bit Prefechtable
        !          10988: dup OF 0 ENDOF    \ Not a valid BarType
        !          10989: ENDCASE
        !          10990: THEN
        !          10991: ;
        !          10992: : assign-var ( size var -- al-mem )
        !          10993: 2dup @                          \ ( size var size cur-mem ) read current free mem
        !          10994: swap #aligned                   \ ( size var al-mem )       align the mem to the size
        !          10995: dup 2swap -rot +                \ ( al-mem var new-mem )    add size to aligned mem
        !          10996: swap !                          \ ( al-mem )                set variable to new mem
        !          10997: ;
        !          10998: : assign-bar-value32 ( bar size var -- 4 )
        !          10999: over IF                         \ IF size > 0
        !          11000: assign-var              \ | ( bar al-mem ) set variable to next mem
        !          11001: swap rtas-config-l!     \ | ( -- )         set the bar to al-mem
        !          11002: ELSE                            \ ELSE
        !          11003: 2drop drop              \ | clear stack
        !          11004: THEN                            \ FI
        !          11005: 4                               \ size of the base-address-register
        !          11006: ;
        !          11007: : assign-bar-value64 ( bar size var -- 8 )
        !          11008: over IF                         \ IF size > 0
        !          11009: assign-var              \ | ( bar al-mem ) set variable to next mem
        !          11010: swap                    \ | ( al-mem addr ) calc config-addr of this bar
        !          11011: 2dup rtas-config-l!     \ | ( al-mem addr ) set the Lower part of the bar to al-mem
        !          11012: 4 + swap 20 rshift      \ | ( al-mem>>32 addr ) prepare the upper part of the al-mem
        !          11013: swap rtas-config-l!     \ | ( -- ) and set the upper part of the bar
        !          11014: ELSE                            \ ELSE
        !          11015: 2drop drop              \ | clear stack
        !          11016: THEN                            \ FI
        !          11017: 8                               \ size of the base-address-register
        !          11018: ;
        !          11019: : assign-mem64-bar ( bar-addr -- 8 )
        !          11020: dup pci-bar-size-mem64         \ fetch size
        !          11021: pci-next-mem                    \ var to change
        !          11022: assign-bar-value64              \ and set it all
        !          11023: ;
        !          11024: : assign-mem32-bar ( bar-addr -- 4 )
        !          11025: dup pci-bar-size-mem32          \ fetch size
        !          11026: pci-next-mem                    \ var to change
        !          11027: assign-bar-value32              \ and set it all
        !          11028: ;
        !          11029: : assign-mmio64-bar ( bar-addr -- 8 )
        !          11030: dup pci-bar-size-mem64          \ fetch size
        !          11031: pci-next-mmio                   \ var to change
        !          11032: assign-bar-value64              \ and set it all
        !          11033: ;
        !          11034: : assign-mmio32-bar ( bar-addr -- 4 )
        !          11035: dup pci-bar-size-mem32          \ fetch size
        !          11036: pci-next-mmio                   \ var to change
        !          11037: assign-bar-value32              \ and set it all
        !          11038: ;
        !          11039: : assign-io-bar ( bar-addr -- 4 )
        !          11040: dup pci-bar-size-io             \ fetch size
        !          11041: pci-next-io                     \ var to change
        !          11042: assign-bar-value32              \ and set it all
        !          11043: ;
        !          11044: : assign-rom-bar ( bar-addr -- )
        !          11045: dup pci-bar-size-rom            \ fetch size
        !          11046: dup IF                          \ IF size > 0
        !          11047: over >r                 \ | save bar addr for enable
        !          11048: pci-next-mmio           \ | var to change
        !          11049: assign-bar-value32      \ | and set it
        !          11050: drop                    \ | forget the BAR length
        !          11051: r@ rtas-config-l@       \ | fetch BAR
        !          11052: 1 or r> rtas-config-l!  \ | and enable the ROM
        !          11053: ELSE                            \ ELSE
        !          11054: 2drop                   \ | clear stack
        !          11055: THEN
        !          11056: ;
        !          11057: : assign-bar ( bar-addr -- reg-size )
        !          11058: dup pci-bar-code@                       \ calc BAR type
        !          11059: dup IF                                  \ IF >0
        !          11060: CASE                            \ | CASE Setup the right type
        !          11061: 1 OF assign-io-bar     ENDOF    \ | - set up an IO-Bar
        !          11062: 2 OF assign-mmio32-bar ENDOF    \ | - set up an 32bit MMIO-Bar
        !          11063: 3 OF assign-mem32-bar  ENDOF    \ | - set up an 32bit MEM-Bar (prefetchable)
        !          11064: 4 OF assign-mmio64-bar ENDOF    \ | - set up an 64bit MMIO-Bar
        !          11065: 5 OF assign-mem64-bar  ENDOF    \ | - set up an 64bit MEM-Bar (prefetchable)
        !          11066: ENDCASE                         \ | ESAC
        !          11067: ELSE                                    \ ELSE
        !          11068: ABORT                           \ | Throw an exception
        !          11069: THEN                                    \ FI
        !          11070: ;
        !          11071: : assign-all-device-bars ( configaddr -- )
        !          11072: 28 10 DO                        \ BARs start at 10 and end at 27
        !          11073: dup i +                 \ calc config-addr of the BAR
        !          11074: assign-bar              \ and set it up
        !          11075: +LOOP                           \ add 4 or 8 to the index and loop
        !          11076: 30 + assign-rom-bar             \ set up the ROM if available
        !          11077: ;
        !          11078: : assign-all-bridge-bars ( configaddr -- )
        !          11079: 18 10 DO                        \ BARs start at 10 and end at 17
        !          11080: dup i +                 \ calc config-addr of the BAR
        !          11081: assign-bar              \ and set it up
        !          11082: +LOOP                           \ add 4 or 8 to the index and loop
        !          11083: 38 + assign-rom-bar             \ set up the ROM if available
        !          11084: ;
        !          11085: : gen-mem64-bar-prop ( prop-addr prop-len bar-addr -- prop-addr prop-len 8 )
        !          11086: dup pci-bar-size-mem64                  \ fetch BAR Size        ( paddr plen baddr bsize )
        !          11087: dup IF                                  \ IF Size > 0
        !          11088: >r dup rtas-config-l@           \ | save size and fetch lower 32 bits ( paddr plen baddr val.lo R: size)
        !          11089: over 4 + rtas-config-l@         \ | fetch upper 32 bits               ( paddr plen baddr val.lo val.hi R: size)
        !          11090: 20 lshift + -10 and >r          \ | calc 64 bit value and save it     ( paddr plen baddr R: size val )
        !          11091: 83000000 or encode-int+         \ | Encode config addr                ( paddr plen R: size val )
        !          11092: r> encode-64+                   \ | Encode assigned addr              ( paddr plen R: size )
        !          11093: r> encode-64+                   \ | Encode size                       ( paddr plen )
        !          11094: ELSE                                    \ ELSE
        !          11095: 2drop                           \ | don't do anything
        !          11096: THEN                                    \ FI
        !          11097: 8                                       \ sizeof(BAR) = 8 Bytes
        !          11098: ;
        !          11099: : gen-pmem64-bar-prop ( prop-addr prop-len bar-addr -- prop-addr prop-len 8 )
        !          11100: dup pci-bar-size-mem64                  \ fetch BAR Size        ( paddr plen baddr bsize )
        !          11101: dup IF                                  \ IF Size > 0
        !          11102: >r dup rtas-config-l@           \ | save size and fetch lower 32 bits ( paddr plen baddr val.lo R: size)
        !          11103: over 4 + rtas-config-l@         \ | fetch upper 32 bits               ( paddr plen baddr val.lo val.hi R: size)
        !          11104: 20 lshift + -10 and >r          \ | calc 64 bit value and save it     ( paddr plen baddr R: size val )
        !          11105: C3000000 or encode-int+         \ | Encode config addr                ( paddr plen R: size val )
        !          11106: r> encode-64+                   \ | Encode assigned addr              ( paddr plen R: size )
        !          11107: r> encode-64+                   \ | Encode size                       ( paddr plen )
        !          11108: ELSE                                    \ ELSE
        !          11109: 2drop                           \ | don't do anything
        !          11110: THEN                                    \ FI
        !          11111: 8                                       \ sizeof(BAR) = 8 Bytes
        !          11112: ;
        !          11113: : gen-mem32-bar-prop ( prop-addr prop-len bar-addr -- prop-addr prop-len 4 )
        !          11114: dup pci-bar-size-mem32                  \ fetch BAR Size        ( paddr plen baddr bsize )
        !          11115: dup IF                                  \ IF Size > 0
        !          11116: >r dup rtas-config-l@           \ | save size and fetch value         ( paddr plen baddr val R: size)
        !          11117: -10 and >r                      \ | calc 32 bit value and save it     ( paddr plen baddr R: size val )
        !          11118: 82000000 or encode-int+         \ | Encode config addr                ( paddr plen R: size val )
        !          11119: r> encode-64+                   \ | Encode assigned addr              ( paddr plen R: size )
        !          11120: r> encode-64+                   \ | Encode size                       ( paddr plen )
        !          11121: ELSE                                    \ ELSE
        !          11122: 2drop                           \ | don't do anything
        !          11123: THEN                                    \ FI
        !          11124: 4                                       \ sizeof(BAR) = 4 Bytes
        !          11125: ;
        !          11126: : gen-pmem32-bar-prop ( prop-addr prop-len bar-addr -- prop-addr prop-len 4 )
        !          11127: dup pci-bar-size-mem32                  \ fetch BAR Size        ( paddr plen baddr bsize )
        !          11128: dup IF                                  \ IF Size > 0
        !          11129: >r dup rtas-config-l@           \ | save size and fetch value         ( paddr plen baddr val R: size)
        !          11130: -10 and >r                      \ | calc 32 bit value and save it     ( paddr plen baddr R: size val )
        !          11131: C2000000 or encode-int+         \ | Encode config addr                ( paddr plen R: size val )
        !          11132: r> encode-64+                   \ | Encode assigned addr              ( paddr plen R: size )
        !          11133: r> encode-64+                   \ | Encode size                       ( paddr plen )
        !          11134: ELSE                                    \ ELSE
        !          11135: 2drop                           \ | don't do anything
        !          11136: THEN                                    \ FI
        !          11137: 4                                       \ sizeof(BAR) = 4 Bytes
        !          11138: ;
        !          11139: : gen-io-bar-prop ( prop-addr prop-len bar-addr -- prop-addr prop-len 4 )
        !          11140: dup pci-bar-size-io                     \ fetch BAR Size                      ( paddr plen baddr bsize )
        !          11141: dup IF                                  \ IF Size > 0
        !          11142: >r dup rtas-config-l@           \ | save size and fetch value         ( paddr plen baddr val R: size)
        !          11143: -4 and >r                       \ | calc 32 bit value and save it     ( paddr plen baddr R: size val )
        !          11144: 81000000 or encode-int+         \ | Encode config addr                ( paddr plen R: size val )
        !          11145: r> encode-64+                   \ | Encode assigned addr              ( paddr plen R: size )
        !          11146: r> encode-64+                   \ | Encode size                       ( paddr plen )
        !          11147: ELSE                                    \ ELSE
        !          11148: 2drop                           \ | don't do anything
        !          11149: THEN                                    \ FI
        !          11150: 4                                       \ sizeof(BAR) = 4 Bytes
        !          11151: ;
        !          11152: : gen-rom-bar-prop ( prop-addr prop-len bar-addr -- prop-addr prop-len )
        !          11153: dup pci-bar-size-rom                    \ fetch BAR Size                      ( paddr plen baddr bsize )
        !          11154: dup IF                                  \ IF Size > 0
        !          11155: >r dup rtas-config-l@           \ | save size and fetch value         ( paddr plen baddr val R: size)
        !          11156: FFFFF800 and >r                 \ | calc 32 bit value and save it     ( paddr plen baddr R: size val )
        !          11157: 82000000 or encode-int+         \ | Encode config addr                ( paddr plen R: size val )
        !          11158: r> encode-64+                   \ | Encode assigned addr              ( paddr plen R: size )
        !          11159: r> encode-64+                   \ | Encode size                       ( paddr plen )
        !          11160: ELSE                                    \ ELSE
        !          11161: 2drop                           \ | don't do anything
        !          11162: THEN                                    \ FI
        !          11163: ;
        !          11164: : pci-add-assigned-address ( prop-addr prop-len bar-addr -- prop-addr prop-len bsize )
        !          11165: dup pci-bar-code@                               \ calc BAR type                         ( paddr plen baddr btype)
        !          11166: CASE                                            \ CASE for the BAR types                ( paddr plen baddr )
        !          11167: 0 OF drop 4              ENDOF          \ - not a valid type so do nothing
        !          11168: 1 OF gen-io-bar-prop     ENDOF          \ - IO-BAR
        !          11169: 2 OF gen-mem32-bar-prop  ENDOF          \ - MEM32
        !          11170: 3 OF gen-pmem32-bar-prop ENDOF          \ - MEM32 prefetchable
        !          11171: 4 OF gen-mem64-bar-prop  ENDOF          \ - MEM64
        !          11172: 5 OF gen-pmem64-bar-prop ENDOF          \ - MEM64 prefetchable
        !          11173: ENDCASE                                         \ ESAC ( paddr plen bsize )
        !          11174: ;
        !          11175: : pci-device-assigned-addresses-prop ( addr -- )
        !          11176: encode-start                                    \ provide mem for property              ( addr paddr plen )
        !          11177: 2 pick 30 + gen-rom-bar-prop                    \ assign the rom bar
        !          11178: 28 10 DO                                        \ we have 6 possible BARs
        !          11179: 2 pick i +                              \ calc BAR address                      ( addr paddr plen bar-addr )      
        !          11180: pci-add-assigned-address                \ and generate the props for the BAR
        !          11181: +LOOP                                           \ increase Index by returned len
        !          11182: s" assigned-addresses" property drop            \ and write it into the device tree
        !          11183: ;
        !          11184: : pci-bridge-assigned-addresses-prop ( addr -- )
        !          11185: encode-start                                    \ provide mem for property
        !          11186: 2 pick 38 + gen-rom-bar-prop                    \ assign the rom bar
        !          11187: 18 10 DO                                        \ we have 2 possible BARs
        !          11188: 2 pick i +                              \ ( addr paddr plen current-addr )
        !          11189: pci-add-assigned-address                \ and generate the props for the BAR
        !          11190: +LOOP                                           \ increase Index by returned len
        !          11191: s" assigned-addresses" property drop            \ and write it into the device tree
        !          11192: ;
        !          11193: : pci-bridge-gen-range ( paddr plen base limit type -- paddr plen )
        !          11194: >r over -                       \ calc size             ( paddr plen base size R:type )
        !          11195: dup 0< IF                       \ IF Size < 0           ( paddr plen base size R:type )
        !          11196: 2drop r> drop           \ | forget values       ( paddr plen )
        !          11197: ELSE                            \ ELSE
        !          11198: 1+ swap 2swap           \ | adjust stack        ( size base paddr plen R:type )
        !          11199: r@ encode-int+          \ | Child type          ( size base paddr plen R:type )
        !          11200: 2 pick encode-64+       \ | Child address       ( size base paddr plen R:type )
        !          11201: r> encode-int+          \ | Parent type         ( size base paddr plen )
        !          11202: rot encode-64+          \ | Parent address      ( size paddr plen )
        !          11203: rot encode-64+          \ | Encode size         ( paddr plen )
        !          11204: THEN                            \ FI
        !          11205: ;
        !          11206: : pci-bridge-gen-mmio-range ( addr prop-addr prop-len -- addr prop-addr prop-len )
        !          11207: 2 pick 20 + rtas-config-l@      \ fetch Value           ( addr paddr plen val )
        !          11208: dup 0000FFF0 and 10 lshift      \ calc base-address     ( addr paddr plen val base )
        !          11209: swap 000FFFFF or                \ calc limit-address    ( addr paddr plen base limit )
        !          11210: 02000000 pci-bridge-gen-range   \ and generate it       ( addr paddr plen )
        !          11211: ;
        !          11212: : pci-bridge-gen-mem-range ( addr prop-addr prop-len -- addr prop-addr prop-len )
        !          11213: 2 pick 24 + rtas-config-l@      \ fetch Value           ( addr paddr plen val )
        !          11214: dup 000FFFFF or                 \ calc limit Bits 31:0  ( addr paddr plen val limit.31:0 )
        !          11215: swap 0000FFF0 and 10 lshift     \ calc base Bits 31:0   ( addr paddr plen limit.31:0 base.31:0 )
        !          11216: 4 pick 28 + rtas-config-l@      \ fetch upper Basebits  ( addr paddr plen limit.31:0 base.31:0 base.63:32 )
        !          11217: 20 lshift or swap               \ and calc Base         ( addr paddr plen base.63:0 limit.31:0 )
        !          11218: 4 pick 2C + rtas-config-l@      \ fetch upper Limitbits ( addr paddr plen base.63:0 limit.31:0 limit.63:32 )
        !          11219: 20 lshift or                    \ and calc Limit        ( addr paddr plen base.63:0 limit.63:0 )
        !          11220: 42000000 pci-bridge-gen-range   \ and generate it       ( addr paddr plen )
        !          11221: ;
        !          11222: : pci-bridge-gen-io-range ( addr prop-addr prop-len -- addr prop-addr prop-len )
        !          11223: 2 pick 1C + rtas-config-l@      \ fetch Value           ( addr paddr plen val )
        !          11224: dup 0000F000 and 00000FFF or    \ calc Limit Bits 15:0  ( addr paddr plen val limit.15:0 )
        !          11225: swap 000000F0 and 8 lshift      \ calc Base Bits 15:0   ( addr paddr plen limit.15:0 base.15:0 )
        !          11226: 4 pick 30 + rtas-config-l@      \ fetch upper Bits      ( addr paddr plen limit.15:0 base.15:0 val )
        !          11227: dup FFFF and 10 lshift rot or   \ calc Base             ( addr paddr plen limit.15:0 val base.31:0 )
        !          11228: -rot FFFF0000 and or            \ calc Limit            ( addr paddr plen base.31:0 limit.31:0 )
        !          11229: 01000000 pci-bridge-gen-range   \ and generate it       ( addr paddr plen )
        !          11230: ;
        !          11231: : pci-bridge-range-props ( addr -- )
        !          11232: encode-start                    \ provide mem for property
        !          11233: pci-bridge-gen-mmio-range       \ generate the non prefetchable Memory Entry
        !          11234: pci-bridge-gen-mem-range        \ generate the prefetchable Memory Entry
        !          11235: pci-bridge-gen-io-range         \ generate the IO Entry
        !          11236: dup IF                          \ IF any space present (propsize>0)
        !          11237: s" ranges" property     \ | write it into the device tree
        !          11238: ELSE                            \ ELSE
        !          11239: 2drop                   \ | forget the properties
        !          11240: THEN                            \ FI
        !          11241: drop                            \ forget the address
        !          11242: ;
        !          11243: : pci-bridge-interrupt-map ( -- )
        !          11244: encode-start                                    \ create the property                           ( paddr plen )
        !          11245: get-node child                                  \ find the first child                          ( paddr plen handle )
        !          11246: BEGIN dup WHILE                                 \ Loop as long as the handle is non-zero        ( paddr plen handle )
        !          11247: dup >r >space                           \ Get the my-space                              ( paddr plen addr R: handle )
        !          11248: pci-gen-irq-entry                       \ and Encode the interrupt settings             ( paddr plen R: handle)
        !          11249: r> peer                                 \ Get neighbour                                 ( paddr plen handle )
        !          11250: REPEAT                                          \ process next childe node                      ( paddr plen handle )
        !          11251: drop                                            \ forget the null                               ( paddr plen )
        !          11252: s" interrupt-map" property                      \ and set it                                    ( -- )
        !          11253: 1 encode-int s" #interrupt-cells" property      \ encode the cell#
        !          11254: f800 encode-int 0 encode-int+ 0 encode-int+     \ encode the bit mask for config addr (Dev only)
        !          11255: 7 encode-int+ s" interrupt-map-mask" property   \ encode IRQ#=7 and generate property
        !          11256: ;
        !          11257: : encode-mem32-bar ( prop-addr prop-len BAR-addr -- prop-addr prop-len 4 )
        !          11258: dup pci-bar-size-mem32                  \ calc BAR-size ( not changing the BAR )
        !          11259: dup IF                                  \ IF BAR-size > 0       ( paddr plen baddr bsize )
        !          11260: >r 02000000 or encode-int+      \ | save size and encode BAR addr
        !          11261: 0 encode-64+                    \ | make mid and lo zero
        !          11262: r> encode-64+                   \ | encode size
        !          11263: ELSE                                    \ ELSE
        !          11264: 2drop                           \ | don't do anything
        !          11265: THEN                                    \ FI
        !          11266: 4                                       \ BAR-Len = 4 (32Bit)
        !          11267: ;
        !          11268: : encode-pmem32-bar ( prop-addr prop-len BAR-addr -- prop-addr prop-len 4 )
        !          11269: dup pci-bar-size-mem32                  \ calc BAR-size ( not changing the BAR )
        !          11270: dup IF                                  \ IF BAR-size > 0       ( paddr plen baddr bsize )
        !          11271: >r 42000000 or encode-int+      \ | save size and encode BAR addr
        !          11272: 0 encode-64+                    \ | make mid and lo zero
        !          11273: r> encode-64+                   \ | encode size
        !          11274: ELSE                                    \ ELSE
        !          11275: 2drop                           \ | don't do anything
        !          11276: THEN                                    \ FI
        !          11277: 4                                       \ BAR-Len = 4 (32Bit)
        !          11278: ;
        !          11279: : encode-mem64-bar ( prop-addr prop-len BAR-addr -- prop-addr prop-len 8 )
        !          11280: dup pci-bar-size-mem64                  \ calc BAR-size ( not changing the BAR )
        !          11281: dup IF                                  \ IF BAR-size > 0       ( paddr plen baddr bsize )
        !          11282: >r 03000000 or encode-int+      \ | save size and encode BAR addr
        !          11283: 0 encode-64+                    \ | make mid and lo zero
        !          11284: r> encode-64+                   \ | encode size
        !          11285: ELSE                                    \ ELSE
        !          11286: 2drop                           \ | don't do anything
        !          11287: THEN                                    \ FI
        !          11288: 8                                       \ BAR-Len = 8 (64Bit)
        !          11289: ;
        !          11290: : encode-pmem64-bar ( prop-addr prop-len BAR-addr -- prop-addr prop-len 8 )
        !          11291: dup pci-bar-size-mem64                  \ calc BAR-size ( not changing the BAR )
        !          11292: dup IF                                  \ IF BAR-size > 0       ( paddr plen baddr bsize )
        !          11293: >r 43000000 or encode-int+      \ | save size and encode BAR addr
        !          11294: 0 encode-64+                    \ | make mid and lo zero
        !          11295: r> encode-64+                   \ | encode size
        !          11296: ELSE                                    \ ELSE
        !          11297: 2drop                           \ | don't do anything
        !          11298: THEN                                    \ FI
        !          11299: 8                                       \ BAR-Len = 8 (64Bit)
        !          11300: ;
        !          11301: : encode-rom-bar ( prop-addr prop-len configaddr -- prop-addr prop-len )
        !          11302: dup pci-bar-size-rom                            \ fetch raw BAR-size
        !          11303: dup IF                                          \ IF BAR is used
        !          11304: >r 02000000 or encode-int+              \ | save size and encode BAR addr
        !          11305: 0 encode-64+                            \ | make mid and lo zero
        !          11306: r> encode-64+                           \ | calc and encode the size
        !          11307: ELSE                                            \ ELSE
        !          11308: 2drop                                   \ | don't do anything
        !          11309: THEN                                            \ FI
        !          11310: ;
        !          11311: : encode-io-bar ( prop-addr prop-len BAR-addr BAR-value -- prop-addr prop-len 4 )
        !          11312: dup pci-bar-size-io                     \ calc BAR-size ( not changing the BAR )
        !          11313: dup IF                                  \ IF BAR-size > 0       ( paddr plen baddr bsize )
        !          11314: >r 01000000 or encode-int+      \ | save size and encode BAR addr
        !          11315: 0 encode-64+                    \ | make mid and lo zero
        !          11316: r> encode-64+                   \ | encode size
        !          11317: ELSE                                    \ ELSE
        !          11318: 2drop                           \ | don't do anything
        !          11319: THEN                                    \ FI
        !          11320: 4                                       \ BAR-Len = 4 (32Bit)
        !          11321: ;
        !          11322: : encode-bar ( prop-addr prop-len bar-addr -- prop-addr prop-len bar-len )
        !          11323: dup pci-bar-code@                               \ calc BAR type
        !          11324: CASE                                            \ CASE for the BAR types ( paddr plen baddr val )
        !          11325: 0 OF drop 4             ENDOF           \ - not a valid type so do nothing
        !          11326: 1 OF encode-io-bar      ENDOF           \ - IO-BAR
        !          11327: 2 OF encode-mem32-bar   ENDOF           \ - MEM32
        !          11328: 3 OF encode-pmem32-bar  ENDOF           \ - MEM32 prefetchable
        !          11329: 4 OF encode-mem64-bar   ENDOF           \ - MEM64
        !          11330: 5 OF encode-pmem64-bar  ENDOF           \ - MEM64 prefetchable
        !          11331: ENDCASE                                         \ ESAC ( paddr plen blen )
        !          11332: ;
        !          11333: : pci-reg-props ( configaddr -- )
        !          11334: dup encode-int                  \ configuration space           ( caddr paddr plen )
        !          11335: 0 encode-64+                    \ make the rest 0
        !          11336: 0 encode-64+                    \ encode the size as 0
        !          11337: 2 pick pci-htype@               \ fetch Header Type             ( caddr paddr plen type )
        !          11338: 1 and IF                        \ IF Bridge                     ( caddr paddr plen )
        !          11339: 18 10 DO                \ | loop over all BARs
        !          11340: 2 pick i +      \ | calc bar-addr               ( caddr paddr plen baddr )
        !          11341: encode-bar      \ | encode this BAR             ( caddr paddr plen blen )
        !          11342: +LOOP              \ | increase LoopIndex by the BARlen
        !          11343: 2 pick 38 +             \ | calc ROM-BAR for a bridge   ( caddr paddr plen baddr )
        !          11344: encode-rom-bar          \ | encode the ROM-BAR          ( caddr paddr plen )
        !          11345: ELSE                            \ ELSE ordinary device          ( caddr paddr plen )
        !          11346: 28 10 DO                 \ | loop over all BARs
        !          11347: 2 pick i +      \ | calc bar-addr               ( caddr paddr plen baddr )
        !          11348: encode-bar      \ | encode this BAR             ( caddr paddr plen blen )
        !          11349: +LOOP              \ | increase LoopIndex by the BARlen
        !          11350: 2 pick 30 +             \ | calc ROM-BAR for a device   ( caddr paddr plen baddr )
        !          11351: encode-rom-bar          \ | encode the ROM-BAR          ( caddr paddr plen )
        !          11352: THEN                            \ FI                            ( caddr paddr plen )
        !          11353: s" reg" property                \ and store it into the property
        !          11354: drop
        !          11355: ;
        !          11356: : pci-common-props ( addr -- )
        !          11357: dup pci-class-name 2dup device-name device-type
        !          11358: dup pci-vendor@    encode-int s" vendor-id"      property
        !          11359: dup pci-device@    encode-int s" device-id"      property
        !          11360: dup pci-revision@  encode-int s" revision-id"    property
        !          11361: dup pci-class@     encode-int s" class-code"     property
        !          11362: 3 encode-int s" #address-cells" property
        !          11363: 2 encode-int s" #size-cells"    property
        !          11364: dup pci-config-ext? IF 1 encode-int s" ibm,pci-config-space-type" property THEN
        !          11365: dup pci-status@
        !          11366: dup 9 rshift 3 and encode-int s" devsel-speed" property
        !          11367: dup 7 rshift 1 and IF 0 0 s" fast-back-to-back" property THEN
        !          11368: dup 6 rshift 1 and IF 0 0 s" 66mhz-capable" property THEN
        !          11369: 5 rshift 1 and IF 0 0 s" udf-supported" property THEN
        !          11370: dup pci-cache@     ?dup IF encode-int s" cache-line-size" property THEN
        !          11371: pci-interrupt@ ?dup IF encode-int s" interrupts"      property THEN
        !          11372: ;
        !          11373: : pci-device-props ( addr -- )
        !          11374: dup pci-common-props
        !          11375: dup pci-min-grant@ encode-int s" min-grant"   property
        !          11376: dup pci-max-lat@   encode-int s" max-latency" property
        !          11377: dup pci-sub-device@ ?dup IF encode-int s" subsystem-id" property THEN
        !          11378: dup pci-sub-vendor@ ?dup IF encode-int s" subsystem-vendor-id" property THEN
        !          11379: dup pci-device-assigned-addresses-prop
        !          11380: pci-reg-props
        !          11381: ;
        !          11382: : pci-bridge-props ( addr -- )
        !          11383: dup pci-bus@
        !          11384: encode-int s" primary-bus" property
        !          11385: encode-int s" secondary-bus" property
        !          11386: encode-int s" subordinate-bus" property
        !          11387: dup pci-bus@ drop encode-int rot encode-int+ s" bus-range" property
        !          11388: pci-device-slots encode-int s" slot-names" property
        !          11389: dup pci-bridge-range-props
        !          11390: dup pci-bridge-assigned-addresses-prop
        !          11391: s" interrupt-map" get-node get-property IF
        !          11392: pci-bridge-interrupt-map
        !          11393: ELSE 2drop THEN
        !          11394: pci-reg-props
        !          11395: ;
        !          11396: : assign-bar-mapping ( bar-offset size var -- )
        !          11397: rot my-unit-64 + -rot
        !          11398: assign-bar-value32 drop
        !          11399: ;
        !          11400: : assigned-addresses-property (  -- )
        !          11401: my-unit-64
        !          11402: dup pci-common-props
        !          11403: pci-device-assigned-addresses-prop
        !          11404: ;
        !          11405: : pci-bridge-generic-setup ( addr -- )
        !          11406: pci-device-slots >r             \ save the slot array on return stack
        !          11407: dup pci-common-props            \ set the common properties before scanning the bus
        !          11408: s" pci" device-type             \ the type is allways "pci"
        !          11409: dup pci-bridge-probe            \ find all device connected to it
        !          11410: dup assign-all-bridge-bars      \ set up all memory access BARs
        !          11411: dup pci-set-irq-line            \ set the interrupt pin
        !          11412: dup pci-set-capabilities        \ set up the capabilities
        !          11413: pci-bridge-props            \ and generate all properties
        !          11414: r> TO pci-device-slots          \ and reset the slot array
        !          11415: ;
        !          11416: : pci-device-generic-setup ( config-addr -- )
        !          11417: dup assign-all-device-bars      \ calc all BARs
        !          11418: dup pci-set-irq-line            \ set the interrupt pin
        !          11419: dup pci-set-capabilities        \ set up the capabilities
        !          11420: dup pci-device-props            \ and generate all properties
        !          11421: drop                            \ forget the config-addr
        !          11422: ;
        !          11423: ��������
        !          11424: (        �8pci-config-bridge.fs: config-xt  ( config-addr xt -- data )
        !          11425: puid >r                            \ Safe puid
        !          11426: my-puid TO puid                    \ Set my-puid
        !          11427: swap dup ffff00 AND 0= IF          \ Has bus-device-function been specified?
        !          11428: my-space OR                     \ No: use my-space instead
        !          11429: THEN
        !          11430: swap execute                       \ Execute the rtas-config-xx function
        !          11431: r> TO puid                         \ Restore previous puid
        !          11432: ;
        !          11433: : config-b@  ( config-addr -- data )  ['] rtas-config-b@ config-xt ;
        !          11434: : config-w@  ( config-addr -- data )  ['] rtas-config-w@ config-xt ;
        !          11435: : config-l@  ( config-addr -- data )  ['] rtas-config-l@ config-xt ;
        !          11436: : config-b!  ( data config-addr -- )  ['] rtas-config-b! config-xt ;
        !          11437: : config-w!  ( data config-addr -- )  ['] rtas-config-w! config-xt ;
        !          11438: : config-l!  ( data config-addr -- )  ['] rtas-config-l! config-xt ;
        !          11439: : config-dump puid >r my-puid TO puid my-space pci-dump r> TO puid ;
        !          11440: : decode-unit ( addr len -- phys.lo ... phys.hi )
        !          11441: 2 hex-decode-unit       \ decode string
        !          11442: B lshift swap           \ shift the devicenumber to the right spot
        !          11443: 8 lshift or             \ add the functionnumber
        !          11444: my-bus 10 lshift or     \ add the busnumber
        !          11445: 0 0 rot                 \ make phys.lo = 0 = phys.mid
        !          11446: ;
        !          11447: : encode-unit ( phys.lo ... phys.hi -- unit-str unit-len )
        !          11448: nip nip                         \ forget the both zeros
        !          11449: dup 8 rshift 7 and swap         \ calc Functionnumber
        !          11450: B rshift 1F and                 \ calc Devicenumber
        !          11451: over IF                         \ IF Function!=0
        !          11452: 2 hex-encode-unit       \ | create string with DevNum,FnNum
        !          11453: ELSE                            \ ELSE
        !          11454: nip 1 hex-encode-unit   \ | create string with only DevNum
        !          11455: THEN                            \ FI
        !          11456: ;
        !          11457: : map-in ( phys.lo phys.mid phys.hi size -- virt )
        !          11458: drop nip nip                         ( phys.hi )
        !          11459: dup FF AND dup 10 28 WITHIN NOT swap 30 <> AND IF
        !          11460: cr ." phys.hi = " . cr
        !          11461: ABORT" map-in with illegal config space address"
        !          11462: THEN
        !          11463: 00FFFFFF AND                         \ Need only bus-dev-fn+register bits
        !          11464: dup config-l@                        ( phys.hi' bar.lo )
        !          11465: dup 7 AND 4 = IF                     \ Is it a 64-bit BAR?
        !          11466: swap 4 + config-l@ lxjoin         \ Add upper part of 64-bit BAR
        !          11467: ELSE
        !          11468: nip
        !          11469: THEN
        !          11470: F NOT AND                            \ Clear indicator bits
        !          11471: ;
        !          11472: : map-out ( virt size -- )
        !          11473: 2drop 
        !          11474: ;
        !          11475: : dma-alloc ( ... size -- virt )
        !          11476: alloc-mem
        !          11477: ;
        !          11478: : dma-free ( virt size -- )
        !          11479: free-mem
        !          11480: ;
        !          11481: : dma-map-in ( ... virt size cacheable? -- devaddr )
        !          11482: 2drop
        !          11483: ;
        !          11484: : dma-map-out ( virt devaddr size -- )
        !          11485: 2drop drop
        !          11486: ;
        !          11487: : dma-sync ( virt devaddr size -- )
        !          11488: 2drop drop
        !          11489: ;
        !          11490: : open true ;
        !          11491: : close ;
        !          11492: ����������0update_flash.fsfalse value flash-new
        !          11493: : update-flash-help ( -- )
        !          11494: cr ." update-flash tool to flash host FW " cr
        !          11495: ."              -f <filename>      : Flash from file (e.g. net:\boot_rom.bin)" cr
        !          11496: ."              -l                 : Flash from load-base" cr
        !          11497: ."              -d                 : Flash from old load base (used by drone)" cr
        !          11498: ."              -c                 : Flash from temp to perm" cr
        !          11499: ."              -r                 : Flash from perm to temp" cr
        !          11500: ;
        !          11501: : flash-read-temp ( -- success? )
        !          11502: get-flashside 1 = IF flash-addr load-base over flash-image-size rmove true
        !          11503: ELSE
        !          11504: false
        !          11505: THEN
        !          11506: ;
        !          11507: : flash-read-perm ( -- success? )
        !          11508: get-flashside 0= IF
        !          11509: flash-addr load-base over flash-image-size rmove true
        !          11510: ELSE
        !          11511: false
        !          11512: THEN
        !          11513: ;
        !          11514: : flash-switch-side ( side -- success? )
        !          11515: set-flashside 0<> IF
        !          11516: s" Cannot change flashside" type cr false
        !          11517: ELSE
        !          11518: true
        !          11519: THEN
        !          11520: ;
        !          11521: : flash-ensure-temp ( -- success? )
        !          11522: get-flashside 0= IF
        !          11523: cr ." Cannot flash perm! Switching to temp side!"
        !          11524: 1 flash-switch-side
        !          11525: ELSE
        !          11526: true
        !          11527: THEN
        !          11528: ;
        !          11529: : update-flash ( "text" )
        !          11530: get-flashside >r                              \ Save old flashside
        !          11531: parse-word                      ( str len )   \ Parse first string
        !          11532: drop dup c@                     ( str first-char )
        !          11533: [char] - <> IF
        !          11534: update-flash-help r> 2drop EXIT
        !          11535: THEN
        !          11536: 1+ c@                           ( second-char )
        !          11537: CASE
        !          11538: [char] f OF
        !          11539: parse-word cr s" do-load" evaluate
        !          11540: flash-ensure-temp TO flash-new
        !          11541: ENDOF
        !          11542: [char] l OF
        !          11543: flash-ensure-temp
        !          11544: ENDOF
        !          11545: [char] d OF
        !          11546: flash-load-base load-base 200000 move
        !          11547: flash-ensure-temp
        !          11548: ENDOF
        !          11549: [char] c OF
        !          11550: flash-read-temp 0= flash-new or IF
        !          11551: ." Cannot commit temp, need to boot on temp first " cr false
        !          11552: ELSE
        !          11553: 0 flash-switch-side
        !          11554: THEN
        !          11555: ENDOF
        !          11556: [char] r OF
        !          11557: flash-read-perm 0= IF
        !          11558: ." Cannot commit perm, need to boot on perm first " cr false
        !          11559: ELSE
        !          11560: 1 flash-switch-side
        !          11561: THEN
        !          11562: ENDOF
        !          11563: dup      OF
        !          11564: false
        !          11565: ENDOF
        !          11566: ENDCASE
        !          11567: 0= IF
        !          11568: update-flash-help r> drop EXIT
        !          11569: THEN
        !          11570: load-base flash-write 0= IF ." Flash write failed !! " cr THEN
        !          11571: r> set-flashside drop                           \ Restore old flashside
        !          11572: ;
        !          11573: ��������0�0xmodem.fs01 CONSTANT XM-SOH   \ Start of header
        !          11574: 04 CONSTANT XM-EOT   \ End-of-transmission
        !          11575: 06 CONSTANT XM-ACK   \ Acknowledge
        !          11576: 15 CONSTANT XM-NAK   \ Neg. acknowledge
        !          11577: 0 VALUE xm-retries   \ Retry count
        !          11578: 0 VALUE xm-block#
        !          11579: : xmodem-get-byte  ( timeout -- byte|-1 )
        !          11580: d# 1000 *
        !          11581: 0 DO
        !          11582: key? IF key UNLOOP EXIT THEN
        !          11583: 1 ms
        !          11584: LOOP
        !          11585: -1
        !          11586: ;
        !          11587: : xmodem-rx-packet  ( address -- success? )
        !          11588: 1 xmodem-get-byte    \ Get block number
        !          11589: dup 0 < IF
        !          11590: 2drop false EXIT  \ Timeout
        !          11591: THEN
        !          11592: 1 xmodem-get-byte    \ Get neg. block number
        !          11593: dup 0 < IF
        !          11594: 3drop false EXIT  \ Timeout
        !          11595: THEN
        !          11596: rot 0                ( blk# ~blk# address chksum )
        !          11597: 80 0 DO
        !          11598: 1 xmodem-get-byte dup 0 < IF     ( blk# ~blk# address chksum byte )
        !          11599: 3drop 2drop UNLOOP FALSE EXIT
        !          11600: THEN
        !          11601: dup 3 pick c!            ( blk# ~blk# address chksum byte )
        !          11602: + swap 1+ swap           ( blk# ~blk# address+1 chksum' )
        !          11603: LOOP
        !          11604: 0ff and
        !          11605: 1 xmodem-get-byte <> IF
        !          11606: 3drop FALSE EXIT
        !          11607: THEN
        !          11608: drop                        ( blk# ~blk# )
        !          11609: over xm-block# <> IF
        !          11610: 2drop FALSE EXIT
        !          11611: THEN                        ( blk# ~blk# )
        !          11612: ff xor =
        !          11613: ;
        !          11614: : (xmodem-load)  ( address -- bytes )
        !          11615: 1 to xm-block#
        !          11616: 0 to xm-retries
        !          11617: dup
        !          11618: BEGIN
        !          11619: d# 10 xmodem-get-byte dup >r
        !          11620: CASE
        !          11621: XM-SOH OF
        !          11622: dup xmodem-rx-packet IF
        !          11623: XM-ACK emit
        !          11624: 80 +                     ( start-addr next-addr  R: rx-byte )
        !          11625: 0 to xm-retries                    \ Reset retry count
        !          11626: xm-block# 1+ ff and to xm-block#   \ Increase current block#
        !          11627: ELSE
        !          11628: XM-NAK emit
        !          11629: xm-retries 1+ to xm-retries  \ Increase retry count
        !          11630: THEN
        !          11631: ENDOF
        !          11632: XM-EOT OF
        !          11633: XM-ACK emit
        !          11634: ENDOF
        !          11635: dup OF
        !          11636: XM-NAK emit
        !          11637: xm-retries 1+ to xm-retries  \ Increase retry count
        !          11638: ENDOF
        !          11639: ENDCASE
        !          11640: r> XM-EOT =
        !          11641: xm-retries d# 10 >= OR
        !          11642: UNTIL                         ( start-address end-address )
        !          11643: swap -                        ( bytes received )
1.1       root     11644: ;
1.1.1.3 ! root     11645: : xmodem-load  ( -- bytes )
        !          11646: cr ." Waiting for start of XMODEM upload..." cr
        !          11647: load-base (xmodem-load)
1.1       root     11648: ;
1.1.1.3 ! root     11649: ��������@8default-font.bin(($$~$$~$$*((
        !          11650: 
        !          11651: *0H00@8DD@"THT"    |(||00  @8DDDDDDDD88DD @x8DD8@@@HH~~@@@xx @@@xDDD8~B   8DDD8DDDD88DDD<D800000000 @ @@ ~~  "$BNRN@@$$$$~BBBB|BBB||BBB|<"`@@@@`"<xDBBBBBBDx~@@@~~@@@~~@@@~~@@@@<B@@@@NBB<BBBB~~BBBB<<$BDHP``PHDB@@@@@@@@@~Bf~ZBBBBBBBbbRRJJFFB$BBBBBB$pHDDHp@@@@$BBBBBJ$pHDDHpPHDB @@ ~~BBBBBBBBB<BBBBB$$$$BBBBBBBZfBBB$$$$BBBB$$~B  B~0        0@  <fB~ 8D<D:@@@@XdDDdX8D@@D8<LDDL<8Dx@D884LDL4D8@@@XdDDDDDH0@@@DHPpHDB08T****jX$$$$v""""XdDdX@@@4LDL4xD@@@@$$8$$$$$DDD((*****DD((D"" < <  $THDDD((���������X0pci-phb.fs0 VALUE phb-debug?
        !          11652: ." Populating " pwd cr
        !          11653: : decode-unit ( addr len -- phys.lo ... phys.hi )
        !          11654: 2 hex-decode-unit       \ decode string
        !          11655: b lshift swap           \ shift the devicenumber to the right spot
        !          11656: 8 lshift or             \ add the functionnumber
        !          11657: 0 0 rot                 \ make phys.lo = 0 = phys.mid
1.1       root     11658: ;
1.1.1.3 ! root     11659: : encode-unit ( phys.lo phys-mid phys.hi -- unit-str unit-len )
        !          11660: nip nip                     \ forget the phys.lo and phys.mid
        !          11661: dup 8 rshift 7 and swap     \ calculate function number
        !          11662: B rshift 1F and             \ calculate device number
        !          11663: over IF 2 ELSE nip 1 THEN   \ create string with dev#,fn# or dev# only?
        !          11664: hex-encode-unit
        !          11665: ;
        !          11666: 0 VALUE my-puid
        !          11667: : setup-puid
        !          11668: s" reg" get-node get-property 0= IF
        !          11669: decode-64 to my-puid 2drop
        !          11670: THEN
        !          11671: ;
        !          11672: setup-puid
        !          11673: : config-b@  puid >r my-puid TO puid rtas-config-b@ r> TO puid ;
        !          11674: : config-w@  puid >r my-puid TO puid rtas-config-w@ r> TO puid ;
        !          11675: : config-l@  puid >r my-puid TO puid rtas-config-l@ r> TO puid ;
        !          11676: : config-b!  puid >r my-puid TO puid rtas-config-b! r> TO puid ;
        !          11677: : config-w!  puid >r my-puid TO puid rtas-config-w! r> TO puid ;
        !          11678: : config-l!  puid >r my-puid TO puid rtas-config-l! r> TO puid ;
        !          11679: : map-in ( phys.lo phys.mid phys.hi size -- virt )
        !          11680: phb-debug? IF cr ." map-in called: " .s cr THEN
        !          11681: drop nip nip                         ( phys.hi )
        !          11682: dup FF AND dup 10 28 WITHIN NOT swap 30 <> AND IF
        !          11683: cr ." phys.hi = " . cr
        !          11684: ABORT" map-in with illegal config space address"
        !          11685: THEN
        !          11686: 00FFFFFF AND                         \ Need only bus-dev-fn+register bits
        !          11687: dup config-l@                        ( phys.hi' bar.lo )
        !          11688: dup 7 AND 4 = IF                     \ Is it a 64-bit BAR?
        !          11689: swap 4 + config-l@ lxjoin         \ Add upper part of 64-bit BAR
        !          11690: ELSE
        !          11691: nip
        !          11692: THEN
        !          11693: F NOT AND                            \ Clear indicator bits
        !          11694: translate-my-address
        !          11695: phb-debug? IF ." map-in done: " .s cr THEN
1.1       root     11696: ;
1.1.1.3 ! root     11697: : map-out ( virt size -- )
        !          11698: phb-debug? IF ." map-out called: " .s cr THEN
        !          11699: 2drop 
1.1       root     11700: ;
1.1.1.3 ! root     11701: : dma-alloc ( size -- virt )
        !          11702: phb-debug? IF cr ." dma-alloc called: " .s cr THEN
        !          11703: fff + fff not and                  \ Align size to next 4k boundary
        !          11704: alloc-mem
        !          11705: dup fff and IF
        !          11706: ." Warning: dma-alloc got unaligned memory!" cr
        !          11707: THEN
1.1       root     11708: ;
1.1.1.3 ! root     11709: : dma-free ( virt size -- )
        !          11710: phb-debug? IF cr ." dma-free called: " .s cr THEN
        !          11711: fff + fff not and                  \ Align size to next 4k boundary
        !          11712: free-mem
        !          11713: ;
        !          11714: 0 VALUE dma-window-liobn        \ Logical I/O bus number
        !          11715: 0 VALUE dma-window-base         \ Start address of window
        !          11716: 0 VALUE dma-window-size         \ Size of the window
        !          11717: : (init-dma-window-vars)  ( -- )
        !          11718: s" ibm,dma-window" calling-child get-property IF
        !          11719: s" ibm,dma-window" calling-child parent get-property 
        !          11720: ABORT" no dma-window property available"
        !          11721: THEN
        !          11722: decode-int TO dma-window-liobn
        !          11723: decode-64 TO dma-window-base
        !          11724: decode-64 TO dma-window-size
        !          11725: 2drop
1.1       root     11726: ;
1.1.1.3 ! root     11727: : (clear-dma-window-vars)  ( -- )
        !          11728: 0 TO dma-window-liobn
        !          11729: 0 TO dma-window-base
        !          11730: 0 TO dma-window-size
        !          11731: ;
        !          11732: : dma-virt2dev  ( virt -- devaddr )
        !          11733: dma-window-size mod dma-window-base +
        !          11734: ;
        !          11735: : dma-map-in  ( virt size cachable? -- devaddr )
        !          11736: phb-debug? IF cr ." dma-map-in called: " .s cr THEN
        !          11737: (init-dma-window-vars)
        !          11738: drop                               ( virt size )
        !          11739: bounds dup >r                      ( v+s virt  R: virt )
        !          11740: swap fff + fff not and             \ Align end to next 4k boundary
        !          11741: swap fff not and                   ( v+s' virt'  R: virt )
        !          11742: ?DO
        !          11743: dma-window-liobn                \ liobn
        !          11744: i dma-virt2dev                  \ ioba
        !          11745: i 3 OR                          \ Make a read- & writeable TCE
        !          11746: hv-put-tce ABORT" H_PUT_TCE failed"
        !          11747: 1000 +LOOP
        !          11748: r> dma-virt2dev
        !          11749: (clear-dma-window-vars)
        !          11750: ;
        !          11751: : dma-map-out  ( virt devaddr size -- )
        !          11752: phb-debug? IF cr ." dma-map-out called: " .s cr THEN
        !          11753: (init-dma-window-vars)
        !          11754: nip                                ( virt size )
        !          11755: bounds                             ( v+s virt )
        !          11756: swap fff + fff not and             \ Align end to next 4k boundary
        !          11757: swap fff not and                   ( v+s' virt' )
        !          11758: ?DO
        !          11759: dma-window-liobn                \ liobn
        !          11760: i dma-virt2dev                  \ ioba
        !          11761: i                               \ Lowest bits not set => invalid TCE
        !          11762: hv-put-tce ABORT" H_PUT_TCE failed"
        !          11763: 1000 +LOOP
        !          11764: (clear-dma-window-vars)
1.1       root     11765: ;
1.1.1.3 ! root     11766: : dma-sync  ( virt devaddr size -- )
        !          11767: phb-debug? IF cr ." dma-sync called: " .s cr THEN
        !          11768: 3drop
1.1       root     11769: ;
1.1.1.3 ! root     11770: : open  true ;
        !          11771: : close ;
        !          11772: : phb-parse-ranges ( -- )
        !          11773: 0  pci-next-io !
        !          11774: 0  pci-max-io !
        !          11775: 0  pci-next-mem !
        !          11776: 0  pci-max-mem !
        !          11777: 0  pci-next-mmio !
        !          11778: 0  pci-max-mmio !
        !          11779: s" ranges" get-node get-property 0<> ABORT" ranges property not found"
        !          11780: BEGIN
        !          11781: dup
        !          11782: WHILE
        !          11783: decode-int                      \ Decode phys.hi
        !          11784: 3000000 AND                     \ Filter out address space in phys.hi
        !          11785: CASE
        !          11786: 1000000 OF                             \ I/O space?
        !          11787: decode-64 dup >r pci-next-io !      \ Decode PCI base address
        !          11788: decode-64 drop                      \ Forget the parent address
        !          11789: decode-64 r> + pci-max-io !         \ Decode size & calc max address
        !          11790: pci-next-io @ 0= IF
        !          11791: pci-next-io @ 10 + pci-next-io ! \ BARs must not be set to zero
1.1       root     11792: THEN
1.1.1.3 ! root     11793: ENDOF
        !          11794: 2000000 OF                             \ 32-bit memory space?
        !          11795: decode-64 pci-next-mem !            \ Decode mem base address
        !          11796: decode-64 drop                      \ Forget the parent address
        !          11797: decode-64 2 / dup >r                \ Decode and calc size/2
        !          11798: pci-next-mem @ + dup pci-max-mem !  \ and calc max mem address
        !          11799: dup pci-next-mmio !                 \ which is the same as MMIO base
        !          11800: r> + pci-max-mmio !                 \ calc max MMIO address
        !          11801: ENDOF
        !          11802: 3000000 OF                             \ 64-bit memory space?
        !          11803: cr ." Warning: 64-bit PCI space not supported yet! "
        !          11804: decode-64 . decode-64 . cr
        !          11805: ENDOF
        !          11806: ENDCASE
        !          11807: REPEAT
        !          11808: 2drop
        !          11809: phb-debug? IF
        !          11810: ." pci-next-io   = " pci-next-io @ . cr
        !          11811: ." pci-max-io    = " pci-max-io  @ . cr
        !          11812: ." pci-next-mem  = " pci-next-mem @ . cr
        !          11813: ." pci-max-mem   = " pci-max-mem  @ . cr
        !          11814: ." pci-next-mmio = " pci-next-mmio @ . cr
        !          11815: ." pci-max-mmio  = " pci-max-mmio @ . cr
        !          11816: THEN
        !          11817: ;
        !          11818: : phb-setup-children
        !          11819: puid >r                          \ Save old value of puid
        !          11820: my-puid TO puid                  \ Set current puid
        !          11821: phb-parse-ranges
        !          11822: 1 0 (probe-pci-host-bridge)
        !          11823: r> TO puid                       \ Restore previous puid
        !          11824: ;
        !          11825: phb-setup-children
        !          11826: ��������h2(rtas.fs4d0 cp
        !          11827: STRUCT
        !          11828: /l field rtas>token
        !          11829: /l field rtas>nargs
        !          11830: /l field rtas>nret
        !          11831: /l field rtas>args0
        !          11832: /l field rtas>args1
        !          11833: /l field rtas>args2
        !          11834: /l field rtas>args3
        !          11835: /l field rtas>args4
        !          11836: /l field rtas>args5
        !          11837: /l field rtas>args6
        !          11838: /l field rtas>args7
        !          11839: /l C * field rtas>args
        !          11840: /l field rtas>bla
        !          11841: CONSTANT /rtas-control-block
        !          11842: CREATE rtas-cb /rtas-control-block allot
        !          11843: rtas-cb /rtas-control-block erase
        !          11844: 0 VALUE rtas-base
        !          11845: 0 VALUE rtas-size
        !          11846: 0 VALUE rtas-entry
        !          11847: 0 VALUE rtas-node
        !          11848: 4d1 cp
        !          11849: : find-qemu-rtas ( -- )
        !          11850: " /rtas" find-device get-node to rtas-node
        !          11851: " linux,rtas-base" rtas-node get-package-property IF
        !          11852: device-end EXIT THEN
        !          11853: drop l@ to rtas-base
        !          11854: " linux,rtas-base" delete-property
        !          11855: " rtas-size" rtas-node get-package-property IF
        !          11856: device-end EXIT THEN
        !          11857: drop l@ to rtas-size
        !          11858: " linux,rtas-entry" rtas-node get-package-property IF
        !          11859: rtas-base to rtas-entry
1.1       root     11860: ELSE
1.1.1.3 ! root     11861: drop l@ to rtas-entry
        !          11862: " linux,rtas-entry" delete-property
1.1       root     11863: THEN
1.1.1.3 ! root     11864: device-end
        !          11865: ;
        !          11866: find-qemu-rtas
        !          11867: 4d2 cp
        !          11868: : enter-rtas ( -- )
        !          11869: rtas-cb rtas-base 0 rtas-entry call-c drop
        !          11870: ;
        !          11871: : rtas-get-token ( str len -- token | 0 )
        !          11872: rtas-node get-package-property IF 0 ELSE drop l@ THEN
        !          11873: ;
        !          11874: : rtas-start-cpu  ( pid loc r3 -- status )
        !          11875: " start-cpu" rtas-get-token rtas-cb rtas>token l!
        !          11876: 3  rtas-cb rtas>nargs l!
        !          11877: 1  rtas-cb rtas>nret l!
        !          11878: rtas-cb rtas>args2 l!
        !          11879: rtas-cb rtas>args1 l!
        !          11880: rtas-cb rtas>args0 l!
        !          11881: 0 rtas-cb rtas>args3 l!
        !          11882: enter-rtas
        !          11883: rtas-cb rtas>args3 l@
        !          11884: ;
        !          11885: : rtas-set-tce-bypass ( unit enable -- )
        !          11886: " ibm,set-tce-bypass" rtas-get-token rtas-cb rtas>token l!
        !          11887: 2 rtas-cb rtas>nargs l!
        !          11888: 0 rtas-cb rtas>nret l!
        !          11889: rtas-cb rtas>args1 l!
        !          11890: rtas-cb rtas>args0 l!
        !          11891: enter-rtas
        !          11892: ;
        !          11893: : rtas-quiesce ( -- )
        !          11894: " quiesce" rtas-get-token rtas-cb rtas>token l!
        !          11895: 0 rtas-cb rtas>nargs l!
        !          11896: 0 rtas-cb rtas>nret l!
        !          11897: enter-rtas
        !          11898: ;
        !          11899: 0 value puid
        !          11900: : rtas-do-config-@ ( config-addr size -- value)
        !          11901: " ibm,read-pci-config" rtas-get-token rtas-cb rtas>token l!
        !          11902: 4 rtas-cb rtas>nargs l!
        !          11903: 2 rtas-cb rtas>nret l!
        !          11904: ( addr size ) rtas-cb rtas>args3 l!
        !          11905: puid ffffffff and rtas-cb rtas>args2 l!
        !          11906: puid 20 rshift rtas-cb rtas>args1 l!
        !          11907: ( addr ) rtas-cb rtas>args0 l!
        !          11908: enter-rtas
        !          11909: rtas-cb rtas>args4 l@ dup IF
        !          11910: drop ffffffff
        !          11911: ELSE
        !          11912: drop rtas-cb rtas>args5 l@
1.1       root     11913: THEN
                   11914: ;
1.1.1.3 ! root     11915: : rtas-do-config-! ( value config-addr size )
        !          11916: " ibm,write-pci-config" rtas-get-token rtas-cb rtas>token l!
        !          11917: 5 rtas-cb rtas>nargs l!
        !          11918: 1 rtas-cb rtas>nret l!
        !          11919: ( value addr size ) rtas-cb rtas>args3 l!
        !          11920: puid ffffffff and rtas-cb rtas>args2 l!
        !          11921: puid 20 rshift rtas-cb rtas>args1 l!
        !          11922: ( value addr ) rtas-cb rtas>args0 l!
        !          11923: ( value ) rtas-cb rtas>args4 l!
        !          11924: enter-rtas
        !          11925: rtas-cb rtas>args5 l@ dup IF
        !          11926: ." RTAS write config err " . cr
        !          11927: ELSE drop THEN
1.1       root     11928: ;
1.1.1.3 ! root     11929: : rtas-config-b@ ( config-addr -- value )
        !          11930: 1 rtas-do-config-@ ff and
1.1       root     11931: ;
1.1.1.3 ! root     11932: : rtas-config-b! ( value config-addr -- )
        !          11933: 1 rtas-do-config-!
1.1       root     11934: ;
1.1.1.3 ! root     11935: : rtas-config-w@ ( config-addr -- value )
        !          11936: 2 rtas-do-config-@ ffff and
1.1       root     11937: ;
1.1.1.3 ! root     11938: : rtas-config-w! ( value config-addr -- )
        !          11939: 2 rtas-do-config-!
1.1       root     11940: ;
1.1.1.3 ! root     11941: : rtas-config-l@ ( config-addr -- value )
        !          11942: 4 rtas-do-config-@ ffffffff and
1.1       root     11943: ;
1.1.1.3 ! root     11944: : rtas-config-l! ( value config-addr -- )
        !          11945: 4 rtas-do-config-!
1.1       root     11946: ;
1.1.1.3 ! root     11947: : of-start-cpu rtas-start-cpu ;
        !          11948: rtas-node set-node
        !          11949: : open true ;
        !          11950: : close ;
        !          11951: : instantiate-rtas ( adr -- entry )
        !          11952: dup rtas-base swap rtas-size move
        !          11953: rtas-entry rtas-base - +
1.1       root     11954: ;
1.1.1.3 ! root     11955: device-end
        !          11956: 4d8 cp
        !          11957: ����������8pci-device_1234_1111.fsmy-space pci-device-generic-setup
        !          11958: d# 800 VALUE disp-width
        !          11959: d# 600 VALUE disp-height
        !          11960: d#   8 VALUE disp-depth
        !          11961: 10 config-l@ translate-my-address 3 not AND  VALUE fb-base
        !          11962: -1 VALUE io-base
        !          11963: false VALUE is-installed?
        !          11964: : vga-io-xlate ( port -- addr )
        !          11965: io-base -1 = IF
        !          11966: dup translate-my-address fff not and to io-base
        !          11967: THEN
        !          11968: io-base +
        !          11969: ;
        !          11970: : vga-w! ( value port -- )
        !          11971: vga-io-xlate rw!-le
        !          11972: ;
        !          11973: : vga-w@ ( port -- value )
        !          11974: vga-io-xlate rw@-le
        !          11975: ;
        !          11976: : vga-b! ( value port -- )
        !          11977: vga-io-xlate rb!
        !          11978: ;
        !          11979: : vga-b@ ( port -- value )
        !          11980: vga-io-xlate rb@
1.1       root     11981: ;
1.1.1.3 ! root     11982: : vbe! ( value index -- )
        !          11983: 1ce vga-w! 1d0 vga-w!
1.1       root     11984: ;
1.1.1.3 ! root     11985: : vbe@ ( index -- value )
        !          11986: 1ce vga-w! 1d0 vga-w@
1.1       root     11987: ;
1.1.1.3 ! root     11988: : draw-rectangle ( adr x y w h -- )
        !          11989: is-installed? IF
        !          11990: 0 ?DO
        !          11991: 4dup ( adr x y w adr x y w )
        !          11992: drop ( adr x y w adr x y )
        !          11993: i + screen-width * + \ calculate offset into framebuffer ((y + i) * screen_width + x) 
        !          11994: frame-buffer-adr + \ add to frame-buffer-adr ( adr x y w adr fb_adr ) 
        !          11995: 1 pick 3 pick i * + swap 3 pick ( adr x y w adr adr_offs fb_adr w )
        !          11996: rmove \ copy line ( adr x y w adr )
        !          11997: drop ( adr x y w )
        !          11998: LOOP
        !          11999: 4drop
        !          12000: ELSE
        !          12001: 4drop drop
        !          12002: THEN
1.1       root     12003: ;
1.1.1.3 ! root     12004: : fill-rectangle ( number x y w h -- )
        !          12005: is-installed? IF
        !          12006: 0 ?DO
        !          12007: 4dup ( number x y w number x y w )
        !          12008: drop ( number x y w number x y )
        !          12009: i + screen-width * + \ calculate offset into framebuffer ((y + i) * screen_width + x) 
        !          12010: frame-buffer-adr + \ add to frame-buffer-adr ( number x y w number adr ) 
        !          12011: 2 pick 2 pick ( number x y w number adr w number )
        !          12012: rfill \ draw line ( number x y w number )
        !          12013: drop ( number x y w )
        !          12014: LOOP
        !          12015: 4drop
        !          12016: ELSE
        !          12017: 4drop drop
        !          12018: THEN
1.1       root     12019: ;
1.1.1.3 ! root     12020: : read-rectangle ( adr x y w h -- )
        !          12021: is-installed? IF
        !          12022: 0 ?DO
        !          12023: 4dup ( adr x y w adr x y w )
        !          12024: drop ( adr x y w adr x y )
        !          12025: i + screen-width * + \ calculate offset into framebuffer ((y + i) * screen_width + x) 
        !          12026: frame-buffer-adr + \ add to frame-buffer-adr ( adr x y w adr fb_adr ) 
        !          12027: 1 pick 3 pick i * + 3 pick ( adr x y w adr fb_adr adr_offs w )
        !          12028: rmove \ copy line ( adr x y w adr )
        !          12029: drop ( adr x y w )
        !          12030: LOOP
        !          12031: 4drop
        !          12032: ELSE
        !          12033: 4drop drop
        !          12034: THEN
1.1       root     12035: ;
1.1.1.3 ! root     12036: : color! ( r g b number -- ) 
        !          12037: 3c8 vga-b!
        !          12038: rot 3c9 vga-b!
        !          12039: swap 3c9 vga-b!
        !          12040: 3c9 vga-b!
        !          12041: ;
        !          12042: : color@ ( number -- r g b ) 
        !          12043: 3c8 vga-b!
        !          12044: 3c9 vga-b@
        !          12045: 3c9 vga-b@
        !          12046: 3c9 vga-b@
        !          12047: ;
        !          12048: : set-colors ( adr number #numbers -- )
        !          12049: over 3c8 vga-b!
        !          12050: swap DO
        !          12051: rb@ 3c9 vga-b!
        !          12052: rb@ 3c9 vga-b!
        !          12053: rb@ 3c9 vga-b!
        !          12054: LOOP
        !          12055: 3drop
1.1       root     12056: ;
1.1.1.3 ! root     12057: : get-colors ( adr number #numbers -- )
        !          12058: 3drop
1.1       root     12059: ;
1.1.1.3 ! root     12060: : default-palette
        !          12061: 100 0 DO
        !          12062: i i i i color!
        !          12063: LOOP
        !          12064: ;
        !          12065: 0 CONSTANT VBE_DISPI_INDEX_ID
        !          12066: 1 CONSTANT VBE_DISPI_INDEX_XRES
        !          12067: 2 CONSTANT VBE_DISPI_INDEX_YRES
        !          12068: 3 CONSTANT VBE_DISPI_INDEX_BPP
        !          12069: 4 CONSTANT VBE_DISPI_INDEX_ENABLE
        !          12070: 5 CONSTANT VBE_DISPI_INDEX_BANK
        !          12071: 6 CONSTANT VBE_DISPI_INDEX_VIRT_WIDTH
        !          12072: 7 CONSTANT VBE_DISPI_INDEX_VIRT_HEIGHT
        !          12073: 8 CONSTANT VBE_DISPI_INDEX_X_OFFSET
        !          12074: 9 CONSTANT VBE_DISPI_INDEX_Y_OFFSET
        !          12075: a CONSTANT VBE_DISPI_INDEX_NB
        !          12076: 00 CONSTANT VBE_DISPI_DISABLED
        !          12077: 01 CONSTANT VBE_DISPI_ENABLED
        !          12078: 02 CONSTANT VBE_DISPI_GETCAPS
        !          12079: 20 CONSTANT VBE_DISPI_8BIT_DAC
        !          12080: 40 CONSTANT VBE_DISPI_LFB_ENABLED
        !          12081: 80 CONSTANT VBE_DISPI_NOCLEARMEM
        !          12082: : init-mode
        !          12083: 0 3c0 vga-b!
        !          12084: VBE_DISPI_DISABLED VBE_DISPI_INDEX_ENABLE vbe!
        !          12085: 0 VBE_DISPI_INDEX_X_OFFSET vbe!
        !          12086: 0 VBE_DISPI_INDEX_Y_OFFSET vbe!
        !          12087: disp-width VBE_DISPI_INDEX_XRES vbe!
        !          12088: disp-height VBE_DISPI_INDEX_YRES vbe!
        !          12089: disp-depth VBE_DISPI_INDEX_BPP vbe!
        !          12090: VBE_DISPI_ENABLED VBE_DISPI_8BIT_DAC or VBE_DISPI_INDEX_ENABLE vbe!
        !          12091: 0 3c0 vga-b!
        !          12092: 20 3c0 vga-b!
        !          12093: ;
        !          12094: : clear-screen
        !          12095: fb-base disp-width disp-height disp-depth 7 + 8 / * * 0 rfill
        !          12096: ;
        !          12097: : read-settings
        !          12098: s" qemu,graphic-width" get-chosen IF
        !          12099: decode-int to disp-width 2drop
        !          12100: THEN
        !          12101: s" qemu,graphic-height" get-chosen IF
        !          12102: decode-int to disp-height 2drop
        !          12103: THEN
        !          12104: s" qemu,graphic-depth" get-chosen IF
        !          12105: decode-int nip nip     
        !          12106: dup 8 =
        !          12107: over f = or
        !          12108: over 10 = or
        !          12109: over 20 = or IF
        !          12110: to disp-depth
        !          12111: ELSE
        !          12112: ." Unsupported bit depth, using 8bpp " drop cr
        !          12113: THEN
        !          12114: THEN
        !          12115: ;
        !          12116: : add-legacy-reg
        !          12117: s" reg" get-node get-property IF
        !          12118: encode-start
        !          12119: ELSE
        !          12120: encode-bytes
        !          12121: THEN
        !          12122: my-space a1000000 or encode-int+ \ non-relocatable, aliased I/O space
        !          12123: 1ce encode-64+ 4 encode-64+ \ addr size
        !          12124: my-space a1000000 or encode-int+ \ non-relocatable, aliased I/O space
        !          12125: 3b0 encode-64+ c encode-64+ \ addr size
        !          12126: my-space a1000000 or encode-int+ \ non-relocatable, aliased I/O space
        !          12127: 3c0 encode-64+ 20 encode-64+ \ addr size
        !          12128: my-space a2000000 or encode-int+ \ non-relocatable, <1MB Memory space
        !          12129: a0000 encode-64+ 20000 encode-64+ \ addr size
        !          12130: s" reg" property \ store "reg" property
        !          12131: ;
        !          12132: : setup-properties
        !          12133: disp-width encode-int s" width" property
        !          12134: disp-height encode-int s" height" property
        !          12135: disp-width disp-depth 7 + 8 / * encode-int s" linebytes" property
        !          12136: disp-depth encode-int s" depth" property
        !          12137: s" ISO8859-1" encode-string s" character-set" property \ i hope this is ok...
        !          12138: s" display" encode-string s" device_type" property
        !          12139: s" qemu,std-vga" encode-string s" compatible" property
        !          12140: ;
        !          12141: : display-remove ( -- ) 
        !          12142: ;
        !          12143: : display-install ( -- )
        !          12144: is-installed? NOT IF
        !          12145: ." Installing QEMU fb" cr
        !          12146: fb-base to frame-buffer-adr
        !          12147: clear-screen
        !          12148: default-font 
        !          12149: set-font
        !          12150: disp-width disp-height
        !          12151: disp-width char-width / disp-height char-height /
        !          12152: disp-depth 7 + 8 /                      ( width height #lines #cols depth )
        !          12153: fb-install
        !          12154: true to is-installed?
        !          12155: THEN
        !          12156: ;
        !          12157: : dimensions ( -- width height )
        !          12158: disp-width disp-height
        !          12159: ;
        !          12160: : set-alias
        !          12161: s" screen" find-alias 0= IF
        !          12162: s" screen" get-node node>path set-alias
        !          12163: ELSE
        !          12164: drop
        !          12165: THEN 
        !          12166: ;
        !          12167: ." qemu vga" cr
        !          12168: pci-master-enable
        !          12169: pci-mem-enable
        !          12170: pci-io-enable
        !          12171: add-legacy-reg
        !          12172: read-settings
        !          12173: init-mode
        !          12174: default-palette
        !          12175: setup-properties
        !          12176: ' display-install is-install
        !          12177: ' display-remove is-remove
        !          12178: set-alias
        !          12179: ���������m8pci-device_1013_00b8.fsmy-space pci-device-generic-setup
        !          12180: d# 800 VALUE disp-width
        !          12181: d# 600 VALUE disp-height
        !          12182: d#   8 VALUE disp-depth
        !          12183: 10 config-l@ translate-my-address 3 not AND  VALUE fb-base
        !          12184: -1 VALUE io-base
        !          12185: false VALUE is-installed?
        !          12186: : vga-io-xlate ( port -- addr )
        !          12187: io-base -1 = IF
        !          12188: dup translate-my-address fff not and to io-base
        !          12189: THEN
        !          12190: io-base +
        !          12191: ;
        !          12192: : vga-w! ( value port -- )
        !          12193: vga-io-xlate rw!-le
        !          12194: ;
        !          12195: : vga-w@ ( port -- value )
        !          12196: vga-io-xlate rw@-le
        !          12197: ;
        !          12198: : vga-b! ( value port -- )
        !          12199: vga-io-xlate rb!
        !          12200: ;
        !          12201: : vga-b@ ( port -- value )
        !          12202: vga-io-xlate rb@
        !          12203: ;
        !          12204: : vga-crt@ ( index -- value )
        !          12205: 3d4 vga-b!
        !          12206: 3d5 vga-b@
        !          12207: ;
        !          12208: : vga-crt! ( value index -- )
        !          12209: 3d4 vga-b!
        !          12210: 3d5 vga-b!
        !          12211: ;
        !          12212: : vga-seq@ ( index -- value )
        !          12213: 3c4 vga-b!
        !          12214: 3c5 vga-b@
        !          12215: ;
        !          12216: : vga-seq! ( value index -- )
        !          12217: 3c4 vga-b!
        !          12218: 3c5 vga-b!
        !          12219: ;
        !          12220: : vga-att@ ( index -- value )
        !          12221: 3c0 vga-b!
        !          12222: 3c1 vga-b@
        !          12223: ;
        !          12224: : vga-att! ( value index -- )
        !          12225: 3c0 vga-b!
        !          12226: 3c0 vga-b!
        !          12227: ;
        !          12228: : vga-gfx@ ( index -- value )
        !          12229: 3ce vga-b!
        !          12230: 3cf vga-b@
        !          12231: ;
        !          12232: : vga-gfx! ( value index -- )
        !          12233: 3ce vga-b!
        !          12234: 3cf vga-b!
1.1       root     12235: ;
1.1.1.3 ! root     12236: : draw-rectangle ( adr x y w h -- )
        !          12237: is-installed? IF
        !          12238: 0 ?DO
        !          12239: 4dup ( adr x y w adr x y w )
        !          12240: drop ( adr x y w adr x y )
        !          12241: i + screen-width * + \ calculate offset into framebuffer ((y + i) * screen_width + x) 
        !          12242: frame-buffer-adr + \ add to frame-buffer-adr ( adr x y w adr fb_adr ) 
        !          12243: 1 pick 3 pick i * + swap 3 pick ( adr x y w adr adr_offs fb_adr w )
        !          12244: rmove \ copy line ( adr x y w adr )
        !          12245: drop ( adr x y w )
        !          12246: LOOP
        !          12247: 4drop
        !          12248: ELSE
        !          12249: 4drop drop
        !          12250: THEN
1.1       root     12251: ;
1.1.1.3 ! root     12252: : fill-rectangle ( number x y w h -- )
        !          12253: is-installed? IF
        !          12254: 0 ?DO
        !          12255: 4dup ( number x y w number x y w )
        !          12256: drop ( number x y w number x y )
        !          12257: i + screen-width * + \ calculate offset into framebuffer ((y + i) * screen_width + x) 
        !          12258: frame-buffer-adr + \ add to frame-buffer-adr ( number x y w number adr ) 
        !          12259: 2 pick 2 pick ( number x y w number adr w number )
        !          12260: rfill \ draw line ( number x y w number )
        !          12261: drop ( number x y w )
        !          12262: LOOP
        !          12263: 4drop
        !          12264: ELSE
        !          12265: 4drop drop
        !          12266: THEN
1.1       root     12267: ;
1.1.1.3 ! root     12268: : read-rectangle ( adr x y w h -- )
        !          12269: is-installed? IF
        !          12270: 0 ?DO
        !          12271: 4dup ( adr x y w adr x y w )
        !          12272: drop ( adr x y w adr x y )
        !          12273: i + screen-width * + \ calculate offset into framebuffer ((y + i) * screen_width + x) 
        !          12274: frame-buffer-adr + \ add to frame-buffer-adr ( adr x y w adr fb_adr ) 
        !          12275: 1 pick 3 pick i * + 3 pick ( adr x y w adr fb_adr adr_offs w )
        !          12276: rmove \ copy line ( adr x y w adr )
        !          12277: drop ( adr x y w )
        !          12278: LOOP
        !          12279: 4drop
        !          12280: ELSE
        !          12281: 4drop drop
        !          12282: THEN
1.1       root     12283: ;
1.1.1.3 ! root     12284: : color! ( r g b number -- ) 
        !          12285: 3c8 vga-b!
        !          12286: rot 2 >> 3c9 vga-b!
        !          12287: swap 2 >> 3c9 vga-b!
        !          12288: 2 >> 3c9 vga-b!
        !          12289: ;
        !          12290: : color@ ( number -- r g b ) 
        !          12291: 3c8 vga-b!
        !          12292: 3c9 vga-b@ 2 <<
        !          12293: 3c9 vga-b@ 2 <<
        !          12294: 3c9 vga-b@ 2 <<
        !          12295: ;
        !          12296: : set-colors ( adr number #numbers -- )
        !          12297: over 3c8 vga-b!
        !          12298: swap DO
        !          12299: rb@ 2 >> 3c9 vga-b!
        !          12300: rb@ 2 >> 3c9 vga-b!
        !          12301: rb@ 2 >> 3c9 vga-b!
        !          12302: LOOP
        !          12303: 3drop
1.1       root     12304: ;
1.1.1.3 ! root     12305: : get-colors ( adr number #numbers -- )
        !          12306: 3drop
1.1       root     12307: ;
1.1.1.3 ! root     12308: : default-palette
        !          12309: 100 0 DO
        !          12310: i i i i color!
        !          12311: LOOP
1.1       root     12312: ;
1.1.1.3 ! root     12313: : init-mode
        !          12314: 3da vga-b@ drop \ reset flip flop
        !          12315: 0f 3c2 vga-b!   \ color mode, ram enable, ...
        !          12316: 12 06 vga-seq!  \ unlock extensions
        !          12317: 05 06 vga-gfx!  \ graphic mode  
        !          12318: disp-depth CASE \ set depth
        !          12319: 8 OF 01 07 vga-seq! ENDOF
        !          12320: f OF 07 07 vga-seq! ENDOF
        !          12321: 10 OF 07 07 vga-seq! ENDOF
        !          12322: 20 OF 09 07 vga-seq! ENDOF
        !          12323: ENDCASE
        !          12324: ff 02 vga-seq!  \ enable plane write
        !          12325: 0a 04 vga-seq!  \ memory mode
        !          12326: 03 17 vga-crt!  \ disable display
        !          12327: disp-width disp-depth 7 + 8 / * 3 >>
        !          12328: dup ff and 13 vga-crt!  \ bottom bits
        !          12329: 4 >> 10 and 1b vga-crt! \ top bit
        !          12330: disp-width 3 >> 1 -                  01 vga-crt! \ H_DISP
        !          12331: disp-height 1 - ff and               12 vga-crt! \ V_DISP
        !          12332: disp-height 1 - 7 >> 2 and
        !          12333: disp-height 1 - 3 >> 40 and
        !          12334: or 10 or                             07 vga-crt! \ OFLOW
        !          12335: ff 18 vga-crt! \ LINE_COMPARE
        !          12336: 40 09 vga-crt! \ MAX_SCAN
        !          12337: 08 04 vga-crt! \ SYNC_START
        !          12338: 0f 02 vga-crt! \ BLANK_START
        !          12339: 00 0c vga-crt!
        !          12340: 00 0d vga-crt!
        !          12341: 40 05 vga-gfx! \ gfx mode
        !          12342: 83 17 vga-crt! \ enable display
        !          12343: 33 3c0 vga-b!  \ gfx in ar index
        !          12344: 00 3c0 vga-b!
        !          12345: 01 01 vga-seq! \ enable seq
        !          12346: ;
        !          12347: : clear-screen
        !          12348: fb-base disp-width disp-height disp-depth 7 + 8 / * * 0 rfill
        !          12349: ;
        !          12350: : read-settings
        !          12351: s" qemu,graphic-width" get-chosen IF
        !          12352: decode-int to disp-width 2drop
        !          12353: THEN
        !          12354: s" qemu,graphic-height" get-chosen IF
        !          12355: decode-int to disp-height 2drop
        !          12356: THEN
        !          12357: s" qemu,graphic-depth" get-chosen IF
        !          12358: decode-int nip nip     
        !          12359: dup 8 =
        !          12360: over f = or
        !          12361: over 10 = or
        !          12362: over 20 = or IF
        !          12363: to disp-depth
        !          12364: ELSE
        !          12365: ." Unsupported bit depth, using 8bpp " drop cr
        !          12366: THEN
        !          12367: THEN
        !          12368: ;
        !          12369: : add-legacy-reg
        !          12370: s" reg" get-node get-property IF
        !          12371: encode-start
        !          12372: ELSE
        !          12373: encode-bytes
        !          12374: THEN
        !          12375: my-space a1000000 or encode-int+ \ non-relocatable, aliased I/O space
        !          12376: 1ce encode-64+ 4 encode-64+ \ addr size
        !          12377: my-space a1000000 or encode-int+ \ non-relocatable, aliased I/O space
        !          12378: 3b0 encode-64+ c encode-64+ \ addr size
        !          12379: my-space a1000000 or encode-int+ \ non-relocatable, aliased I/O space
        !          12380: 3c0 encode-64+ 20 encode-64+ \ addr size
        !          12381: my-space a2000000 or encode-int+ \ non-relocatable, <1MB Memory space
        !          12382: a0000 encode-64+ 20000 encode-64+ \ addr size
        !          12383: s" reg" property \ store "reg" property
        !          12384: ;
        !          12385: : setup-properties
        !          12386: disp-width encode-int s" width" property
        !          12387: disp-height encode-int s" height" property
        !          12388: disp-width disp-depth 7 + 8 / * encode-int s" linebytes" property
        !          12389: disp-depth encode-int s" depth" property
        !          12390: s" ISO8859-1" encode-string s" character-set" property \ i hope this is ok...
        !          12391: s" display" encode-string s" device_type" property
        !          12392: ;
        !          12393: : display-remove ( -- ) 
        !          12394: ;
        !          12395: : display-install ( -- )
        !          12396: is-installed? NOT IF
        !          12397: ." Installing QEMU fb" cr
        !          12398: fb-base to frame-buffer-adr
        !          12399: default-font 
        !          12400: set-font
        !          12401: disp-width disp-height
        !          12402: disp-width char-width / disp-height char-height /
        !          12403: disp-depth 7 + 8 /                      ( width height #lines #cols depth )
        !          12404: fb-install
        !          12405: true to is-installed?
        !          12406: THEN
        !          12407: ;
        !          12408: : dimensions ( -- width height )
        !          12409: disp-width disp-height
        !          12410: ;
        !          12411: : set-alias
        !          12412: s" screen" find-alias 0= IF
        !          12413: s" screen" get-node node>path set-alias
        !          12414: ELSE
        !          12415: drop
        !          12416: THEN 
1.1       root     12417: ;
1.1.1.3 ! root     12418: ." cirrus vga" cr
        !          12419: pci-master-enable
        !          12420: pci-mem-enable
        !          12421: pci-io-enable
        !          12422: add-legacy-reg
        !          12423: read-settings
        !          12424: init-mode
        !          12425: clear-screen
        !          12426: default-palette
        !          12427: setup-properties
        !          12428: ' display-install is-install
        !          12429: ' display-remove is-remove
        !          12430: set-alias
        !          12431: ���������E0pci-class_02.fss" network [ " type my-space pci-class-name type s"  ]" type
        !          12432: my-space pci-device-generic-setup
        !          12433: my-space pci-alias-net
        !          12434: s" network" device-type
        !          12435: cr
        !          12436: INSTANCE VARIABLE obp-tftp-package
        !          12437: : open  ( -- okay? )
        !          12438: open IF           \ enables PCI mem, io and Bus master and returns TRUE
        !          12439: my-args s" obp-tftp" $open-package obp-tftp-package ! true
1.1       root     12440: ELSE
                   12441: false
1.1.1.3 ! root     12442: THEN ;
        !          12443: : close  ( -- )
        !          12444: obp-tftp-package @ close-package
        !          12445: close ;         \ disables PCI mem, io and Bus master
        !          12446: : load  ( addr -- len )
        !          12447: s" load" obp-tftp-package @ $call-method  ;
        !          12448: : ping  ( -- )  s" ping" obp-tftp-package @ $call-method  ;
        !          12449: ��������8&�0pci-class_0c.fss" serial bus [ " type my-space pci-class-name type s"  ]" type cr
1.1       root     12450: my-space pci-device-generic-setup
                   12451: : handle-usb-ohci-class  ( -- )
                   12452: 4 config-w@ 110 or 4 config-w!
                   12453: pci-master-enable               \ set PCI Bus master bit and
                   12454: pci-mem-enable                  \ memory space enable for USB scan
1.1.1.3 ! root     12455: set-ohci-alias
1.1       root     12456: ;
                   12457: : handle-sbc-subclass  ( -- )
                   12458: my-space pci-class@ ffff and CASE         \ get PCI sub-class and interface
                   12459: 0310 OF handle-usb-ohci-class ENDOF    \ USB OHCI controller
                   12460: ENDCASE
                   12461: ;
                   12462: handle-sbc-subclass
1.1.1.3 ! root     12463: ��������X�X�0usb-ohci.fss" usb" device-type
1.1       root     12464: 1 encode-int s" #address-cells" property
                   12465: 0 encode-int s" #size-cells" property
                   12466: : encode-unit ( port -- unit-str unit-len ) 1 hex-encode-unit ;
                   12467: : decode-unit ( addr len -- port ) 1 hex-decode-unit ;
                   12468: STRUCT
                   12469: /l field td>tattr
                   12470: /l field td>cbptr
                   12471: /l field td>ntd
                   12472: /l field td>bfrend
                   12473: CONSTANT /tdlen
                   12474: STRUCT
                   12475: /l field ed>eattr
                   12476: /l field ed>tdqtp
                   12477: /l field ed>tdqhp
                   12478: /l field ed>ned
                   12479: CONSTANT /edlen
                   12480: STRUCT
                   12481: /l field hc>hcattr
                   12482: /l field hc>hcdone
                   12483: CONSTANT /hclen
1.1.1.3 ! root     12484: : get-base-address ( -- baseaddr )
        !          12485: s" assigned-addresses" get-node get-property
        !          12486: ABORT" Could not get OHCI base address"
        !          12487: decode-int drop                          ( addr len )
        !          12488: decode-64 nip nip                        ( n )
        !          12489: translate-my-address
        !          12490: ;
        !          12491: get-base-address CONSTANT baseaddrs
1.1       root     12492: baseaddrs      CONSTANT HcRevision
                   12493: baseaddrs 4  + CONSTANT hccontrol
                   12494: baseaddrs 8  + CONSTANT hccomstat
                   12495: baseaddrs 0c + CONSTANT hcintstat
                   12496: baseaddrs 14 + CONSTANT hcintdsbl
                   12497: baseaddrs 18 + CONSTANT hchccareg
                   12498: baseaddrs 20 + CONSTANT hcctrhead
                   12499: baseaddrs 24 + CONSTANT hccurcont
                   12500: baseaddrs 28 + CONSTANT hcbulkhead
                   12501: baseaddrs 2c + CONSTANT hccurbulk
                   12502: baseaddrs 30 + CONSTANT hcdnehead
                   12503: baseaddrs 34 + CONSTANT hcintrval
                   12504: baseaddrs 40 + CONSTANT HcPeriodicStart
                   12505: baseaddrs 48 + CONSTANT hcrhdescA
                   12506: baseaddrs 4c + CONSTANT hcrhdescB
                   12507: baseaddrs 50 + CONSTANT HcRhStatus
                   12508: baseaddrs 54 + CONSTANT hcrhpstat
                   12509: baseaddrs 58 + CONSTANT hcrhpstat2
                   12510: baseaddrs 5c + CONSTANT hcrhpstat3
                   12511: usb-debug-flag IF
                   12512: 0 config-l@ ."    - VENDOR: " 8 .r cr
                   12513: 40 config-l@ ."    - PMC   : " 8 .r
                   12514: 44 config-l@ ."      PMCSR : " 8 .r cr
                   12515: E0 config-l@ ."    - EXT1  : " 8 .r
                   12516: E4 config-l@ ."      EXT2  : " 8 .r cr
                   12517: THEN
                   12518: 2 CONSTANT WDH
                   12519: 1      CONSTANT RHP-CCS    \ Current Connect Status
                   12520: 2      CONSTANT RHP-PES    \ Port Enable Status
                   12521: 10     CONSTANT RHP-PRS    \ Port Reset Status
                   12522: 100    CONSTANT RHP-PPS    \ Port Power Status
                   12523: 10000  CONSTANT RHP-CSC    \ Connect Status Changed
                   12524: 100000 CONSTANT RHP-PRSC   \ Port Reset Status Changed
                   12525: 0 CONSTANT OHCI-DP-SETUP
                   12526: 1 CONSTANT OHCI-DP-OUT
                   12527: 2 CONSTANT OHCI-DP-IN
                   12528: 3 CONSTANT OHCI-DP-INVALID
                   12529: 8006000100001200 CONSTANT get-ddescp
                   12530: 8006000200000900 CONSTANT get-cdescp
                   12531: 8006000400000900 CONSTANT get-idescp
                   12532: 8006000500000700 CONSTANT get-edescp
                   12533: A006000000001000 CONSTANT get-hdescp
                   12534: 0009010000000000 CONSTANT set-cdescp
                   12535: 2303010004000000 CONSTANT hpenable-set
                   12536: 2303040001000000 CONSTANT hp1rst-set
                   12537: 2303040002000000 CONSTANT hp2rst-set
                   12538: 2303040003000000 CONSTANT hp3rst-set
                   12539: 2303040004000000 CONSTANT hp4rst-set
                   12540: 2303080001000000 CONSTANT hp1pwr-set
                   12541: 2303080002000000 CONSTANT hp2pwr-set
                   12542: 2303080003000000 CONSTANT hp3pwr-set
                   12543: 2303080004000000 CONSTANT hp4pwr-set
                   12544: A003000000000400 CONSTANT hstatus-get
                   12545: A300000001000400 CONSTANT hp1sta-get
                   12546: A300000002000400 CONSTANT hp2sta-get
                   12547: A300000003000400 CONSTANT hp3sta-get
                   12548: A300000004000400 CONSTANT hp4sta-get
                   12549: 8008000000000100 CONSTANT get-config
                   12550: A1FE000000000100 CONSTANT GET-MAX-LUN
                   12551: 2    18 lshift CONSTANT DATA0-TOGGLE
                   12552: 3    18 lshift CONSTANT DATA1-TOGGLE
                   12553: 0f   1c lshift CONSTANT CC-FRESH-TD
                   12554: 8 CONSTANT STD-REQUEST-SETUP-SIZE
                   12555: 0    13 lshift CONSTANT TD-DP-SETUP
                   12556: 1    13 lshift CONSTANT TD-DP-OUT
                   12557: 2    13 lshift CONSTANT TD-DP-IN
                   12558: 400001    CONSTANT ed-cntatr
                   12559: 400002    CONSTANT ed-cntatr1
                   12560: 80081     CONSTANT ed-hubatr
                   12561: 80000     CONSTANT ed-defatr
                   12562: 0f0e40000 CONSTANT td-attr
                   12563: 00 VALUE ptr
1.1.1.3 ! root     12564: 0 VALUE instance-count
1.1       root     12565: 200 CONSTANT MAX-TDS
                   12566: 0 VALUE td-freelist-head
                   12567: 0 VALUE td-freelist-tail
                   12568: 0 VALUE num-free-tds
                   12569: 0 VALUE max-rh-ports
                   12570: 0 VALUE current-stat
1.1.1.3 ! root     12571: VARIABLE td-list-region
        !          12572: VARIABLE td-list-region-dma
1.1       root     12573: 14 CONSTANT MAX-EDS
                   12574: 0 VALUE ed-freelist-head
                   12575: 0 VALUE num-free-eds
1.1.1.3 ! root     12576: VARIABLE ed-list-region
        !          12577: VARIABLE ed-list-region-dma
1.1       root     12578: 0 VALUE usb-address
                   12579: 0 VALUE initial-hub-address
                   12580: 0 VALUE new-device-address
                   12581: 0 VALUE mps
                   12582: 0 VALUE DEBUG-TDS
                   12583: 0 VALUE case-failed  \ available for general use to see IF a CASE statement
                   12584: 0 VALUE WHILE-failed \ available for general use to see IF a WHILE LOOP
                   12585: 8 CONSTANT DEFAULT-CONTROL-MPS
                   12586: 12 CONSTANT DEVICE-DESCRIPTOR-LEN
                   12587: 1 CONSTANT DEVICE-DESCRIPTOR-TYPE
                   12588: 1 CONSTANT DEVICE-DESCRIPTOR-TYPE-OFFSET
                   12589: 4 CONSTANT DEVICE-DESCRIPTOR-DEVCLASS-OFFSET
                   12590: 7 CONSTANT DEVICE-DESCRIPTOR-MPS-OFFSET
                   12591: 20 CONSTANT BULK-CONFIG-DESCRIPTOR-LEN
                   12592: 9 CONSTANT HUB-DEVICE-CLASS
                   12593: 0 CONSTANT NO-CLASS
                   12594: 0 VALUE temp1
                   12595: 0 VALUE temp2
                   12596: 0 VALUE temp3
                   12597: 0 VALUE extra-bytes
                   12598: 0 VALUE num-td
                   12599: 0 VALUE current
                   12600: 0 VALUE device-speed
1.1.1.3 ! root     12601: 0 VALUE setup-packet     \ 8 bytes for setup packet
        !          12602: 0 VALUE ch-buffer        \ 1 byte character buffer
        !          12603: VARIABLE dd-buffer
        !          12604: VARIABLE dd-buffer-dma
        !          12605: VARIABLE cd-buffer
        !          12606: VARIABLE cd-buffer-dma
        !          12607: 109 CONSTANT OHCI-GLOBAL-DMA-BUF-SIZE
        !          12608: 0 VALUE hchcca
        !          12609: 0 VALUE hchcca-dma
        !          12610: : (init-global-dma-bufs)
        !          12611: OHCI-GLOBAL-DMA-BUF-SIZE dma-alloc TO hchcca
        !          12612: hchcca OHCI-GLOBAL-DMA-BUF-SIZE 0 dma-map-in TO hchcca-dma
        !          12613: hchcca ff and IF
        !          12614: s" Warning: hchcca not aligned!" usb-debug-print
        !          12615: THEN
        !          12616: hchcca 8 + TO setup-packet
        !          12617: setup-packet 1 + TO ch-buffer
        !          12618: s" hchcca = " hchcca usb-debug-print-val
        !          12619: ;
        !          12620: (init-global-dma-bufs)
        !          12621: 84 hchcca + CONSTANT hchccadneq                   \ HccaDoneHead
        !          12622: hchcca-dma hchcca - CONSTANT virt2phys-offset
        !          12623: : virt2phys  ( virt -- phys )
        !          12624: dup 0<> IF
        !          12625: virt2phys-offset +
        !          12626: THEN
        !          12627: ;
        !          12628: : phys2virt  ( phys -- virt )
        !          12629: dup 0<> IF
        !          12630: virt2phys-offset -
        !          12631: THEN
        !          12632: ;
1.1       root     12633: : Show-OHCI-Register
                   12634: ." -> OHCI-Register: " cr
                   12635: ." - HcControl : " hccontrol       rl@-le 8 .r
                   12636: ."   CmdStat   : " hccomstat       rl@-le 8 .r
                   12637: ."   HcInterr. : " hcintstat       rl@-le 8 .r cr
                   12638: ." - HcFmIntval: " hcintrval       rl@-le 8 .r
                   12639: ."   Per. Start: " HcPeriodicStart rl@-le 8 .r cr
                   12640: ." - PortStat-1: " hcrhpstat       rl@-le 8 .r
                   12641: ."   PortStat-2: " hcrhpstat2      rl@-le 8 .r
                   12642: ."   PortStat-3: " hcrhpstat3      rl@-le 8 .r cr
                   12643: ."   Descr-A   : " hcrhdescA       rl@-le 8 .r
                   12644: ."   Descr-B   : " hcrhdescB       rl@-le 8 .r
                   12645: ."   HcRhStat  : " HcRhStatus      rl@-le 8 .r cr
                   12646: ;
                   12647: : display-ed ( ED-ADDRESS -- )
                   12648: TO temp1
                   12649: usb-debug-flag IF
                   12650: s" Dump OF ED " type temp1 u. cr
                   12651: s" eattr    : " type temp1 ed>eattr l@-le u. cr
                   12652: s" tdqhp    : " type temp1 ed>tdqhp l@-le u. cr
                   12653: s" tdqtp    : " type temp1 ed>tdqtp l@-le u. cr
                   12654: s" ned      : " type temp1 ed>ned   l@-le u. cr
                   12655: THEN
                   12656: ;
                   12657: : display-td ( TD-ADDRESS -- )
                   12658: TO temp1
                   12659: usb-debug-flag IF
                   12660: s" TD " type temp1 u. s" dump: " type cr
                   12661: s" td>tattr  : " type temp1 td>tattr l@-le u. cr
                   12662: s" td>cbptr  : " type temp1 td>cbptr l@-le u. cr
                   12663: s" td>ntd    : " type temp1 td>ntd l@-le u. cr
                   12664: s" td>bfrend : " type temp1 td>bfrend l@-le u. cr
                   12665: THEN
                   12666: ;
                   12667: : display-descriptors ( ED-ADDRESS -- )
1.1.1.3 ! root     12668: 10  1- not and                             ( ED-ADDRESS~ )
        !          12669: dup display-ed ed>tdqhp l@-le phys2virt    ( ED-ADDRESS~ )
        !          12670: BEGIN
        !          12671: 10  1- not and                          ( ED-ADDRESS~ )
        !          12672: dup 0<>                                 ( ED-ADDRESS~ TRUE | FALSE )
1.1       root     12673: WHILE
1.1.1.3 ! root     12674: dup  display-td td>ntd l@-le phys2virt  ( ED-ADDRESS~ )
1.1       root     12675: REPEAT
                   12676: drop
                   12677: ;
                   12678: : zero-out-a-td-except-link ( td -- )
                   12679: dup 0 swap td>tattr  l!-le             ( td )
                   12680: dup 0 swap td>cbptr  l!-le             ( td )
                   12681: dup 0 swap td>bfrend l!-le             ( td )
                   12682: drop
                   12683: ;
                   12684: : initialize-td-free-list ( -- )
                   12685: MAX-TDS 0= IF EXIT THEN
                   12686: td-list-region @ 0= IF EXIT THEN
                   12687: td-list-region @ TO temp1
                   12688: 0 TO temp2  BEGIN
                   12689: temp1 zero-out-a-td-except-link
1.1.1.3 ! root     12690: temp1 /tdlen +  dup virt2phys  temp1 td>ntd  l!-le  TO temp1
1.1       root     12691: temp2 1+ TO temp2
                   12692: temp2 MAX-TDS =                ( TRUE | FALSE )
                   12693: UNTIL
                   12694: temp1 /tdlen - dup 0 swap td>ntd l!-le TO td-freelist-tail
                   12695: td-list-region @ TO td-freelist-head
                   12696: MAX-TDS TO num-free-tds
                   12697: ;
                   12698: : allocate-td-list ( n -- head tail )
                   12699: dup 0= IF drop 0 0 EXIT THEN           ( 0 0 )
                   12700: dup num-free-tds > IF drop 0 0 EXIT THEN     ( 0 0 )
                   12701: dup num-free-tds = IF                  ( n )
                   12702: drop td-freelist-head td-freelist-tail ( td-freelist-head td-freelist-tail )
                   12703: 0 TO td-freelist-head                  ( td-freelist-head td-freelist-tail )
                   12704: 0 TO td-freelist-tail                  ( td-freelist-head td-freelist-tail )
                   12705: 0 TO num-free-tds                              ( td-freelist-head td-freelist-tail )
                   12706: EXIT
                   12707: THEN
                   12708: dup num-free-tds swap - TO num-free-tds        ( n )
                   12709: td-freelist-head                               ( n td-list-head )
                   12710: dup TO temp1                                   ( n td-list-head )
                   12711: swap                                   ( td-list-head n )
                   12712: 0 DO                                           ( td-list-head   )
                   12713: temp1 TO temp2                         ( td-list-head   )
1.1.1.3 ! root     12714: temp1 td>ntd l@-le phys2virt  TO temp1 ( td-list-head   )
1.1       root     12715: LOOP                                           ( td-list-head   )
                   12716: temp2                                  ( td-list-head td-list-tail )
                   12717: dup td>ntd 0 swap l!-le                        ( td-list-head td-list-tail )
                   12718: temp1 TO td-freelist-head                      ( td-list-head td-list-tail )
                   12719: ;
                   12720: : find-td-list-tail-and-size  ( head -- tail n )
                   12721: TO temp1
                   12722: 0 TO temp2
                   12723: 0 TO temp3
                   12724: DEBUG-TDS  IF
                   12725: s" BEGIN find-td-list-tail-and-size: "   usb-debug-print
                   12726: THEN
                   12727: BEGIN
                   12728: temp1 0<>                                      ( TRUE|FALSE )
                   12729: WHILE
                   12730: DEBUG-TDS  IF
                   12731: temp1 u. cr
                   12732: THEN
                   12733: temp1 TO temp3
1.1.1.3 ! root     12734: temp1 td>ntd l@-le phys2virt TO temp1
1.1       root     12735: temp2 1+ TO temp2
                   12736: REPEAT
                   12737: temp3 temp2                                    ( tail n )
                   12738: DEBUG-TDS  IF
                   12739: s" END find-td-list-tail-and-size"   usb-debug-print
                   12740: THEN
                   12741: ;
                   12742: : (free-td-list) ( head  -- )
                   12743: dup find-td-list-tail-and-size num-free-tds + TO num-free-tds ( head tail )
                   12744: td-freelist-tail 0=  IF                                         ( head tail )
                   12745: dup TO td-freelist-tail                                         ( head tail )
                   12746: THEN                                                            ( head tail )
1.1.1.3 ! root     12747: td>ntd td-freelist-head virt2phys swap l!-le                    ( head )
1.1       root     12748: TO td-freelist-head
                   12749: ;
                   12750: : zero-out-an-ed-except-link ( ed -- )
                   12751: dup 0 swap ed>eattr  l!-le             ( ed )
                   12752: dup 0 swap ed>tdqtp  l!-le             ( ed )
                   12753: dup 0 swap ed>tdqhp  l!-le             ( ed )
                   12754: drop
                   12755: ;
                   12756: : initialize-ed-free-list ( -- )
                   12757: MAX-EDS 0= IF EXIT THEN
                   12758: ed-list-region @ 0= IF
                   12759: s" init-ed-list: ed-list-region is not allocated!"   usb-debug-print
                   12760: EXIT
                   12761: THEN
                   12762: ed-list-region @ TO temp1
                   12763: 0 TO temp2   BEGIN
                   12764: temp1 zero-out-an-ed-except-link
1.1.1.3 ! root     12765: usb-debug-flag IF
        !          12766: ." ED " temp2 . ."  v: " temp1 . ."  p: " temp1 virt2phys . cr
        !          12767: THEN
        !          12768: temp1 /edlen +  dup virt2phys  temp1 ed>ned  l!-le  TO temp1
1.1       root     12769: temp2 1+ TO temp2
                   12770: temp2 MAX-EDS =
                   12771: UNTIL
                   12772: temp1 /edlen - ed>ned 0 swap l!-le
                   12773: ed-list-region @ TO ed-freelist-head
                   12774: MAX-EDS TO num-free-eds
                   12775: ;
                   12776: : allocate-ed  ( -- ed-ptr )
                   12777: num-free-eds 0= IF 0 EXIT THEN
                   12778: ed-freelist-head                                       ( ed-freelist-head )
1.1.1.3 ! root     12779: ed-freelist-head ed>ned                                ( ed-freelist-head ned )
        !          12780: l@-le phys2virt TO ed-freelist-head                    ( ed-freelist-head )
1.1       root     12781: num-free-eds 1- TO num-free-eds                        ( ed-freelist-head )
                   12782: dup ed>ned 0 swap l!-le \ Terminate the Link.  ( ed-freelist-head )
                   12783: ;
                   12784: : free-ed ( ed-ptr  -- )
                   12785: dup zero-out-an-ed-except-link                 ( ed-ptr )
1.1.1.3 ! root     12786: dup ed>ned ed-freelist-head virt2phys swap l!-le       ( ed-ptr )
1.1       root     12787: TO ed-freelist-head
                   12788: num-free-eds 1+ TO num-free-eds
                   12789: ;
                   12790: : (allocate-mem)  ( -- )
1.1.1.3 ! root     12791: /tdlen MAX-TDS * 10 +
        !          12792: dup dma-alloc                          ( td-region-size td-list-region-ptr )
        !          12793: dup td-list-region !
        !          12794: dup f and IF
1.1       root     12795: s" Warning: td-list-region not aligned!" usb-debug-print
                   12796: THEN
1.1.1.3 ! root     12797: swap 0 dma-map-in td-list-region-dma !
1.1       root     12798: initialize-td-free-list
1.1.1.3 ! root     12799: /edlen MAX-EDS * 10 +
        !          12800: dup dma-alloc                          ( ed-region-size ed-list-region-ptr )
        !          12801: dup ed-list-region !
        !          12802: dup f and IF
1.1       root     12803: s" Warning: ed-list-region not aligned!" usb-debug-print
                   12804: THEN
1.1.1.3 ! root     12805: swap 0 dma-map-in ed-list-region-dma !
1.1       root     12806: initialize-ed-free-list
1.1.1.3 ! root     12807: DEVICE-DESCRIPTOR-LEN chars dup dma-alloc
        !          12808: dup dd-buffer !                        ( dd-len dd-buf )
        !          12809: swap 0 dma-map-in dd-buffer-dma !
        !          12810: BULK-CONFIG-DESCRIPTOR-LEN chars dup dma-alloc
        !          12811: dup cd-buffer !                        ( cd-len cd-buf )
        !          12812: swap 0 dma-map-in cd-buffer-dma !
        !          12813: s" td-list-region = " td-list-region @ usb-debug-print-val
        !          12814: s" ed-list-region = " ed-list-region @ usb-debug-print-val
        !          12815: s" dd-buffer = " dd-buffer @ usb-debug-print-val
        !          12816: s" cd-buffer-dma = " cd-buffer-dma @ usb-debug-print-val
1.1       root     12817: ;
                   12818: : (de-allocate-mem)  ( -- )
                   12819: td-list-region @ ?dup IF
1.1.1.3 ! root     12820: /tdlen MAX-TDS * 10 +               ( td-list-region td-region-size )
        !          12821: 2dup td-list-region-dma @ swap dma-map-out
        !          12822: dma-free
1.1       root     12823: 0 td-list-region !
1.1.1.3 ! root     12824: 0 td-list-region-dma !
1.1       root     12825: THEN
                   12826: ed-list-region @ ?dup IF
1.1.1.3 ! root     12827: /edlen MAX-EDS * 10 +
        !          12828: 2dup ed-list-region-dma @ swap dma-map-out
        !          12829: dma-free
1.1       root     12830: 0 ed-list-region !
1.1.1.3 ! root     12831: 0 ed-list-region-dma !
1.1       root     12832: THEN
                   12833: dd-buffer @ ?dup IF
1.1.1.3 ! root     12834: DEVICE-DESCRIPTOR-LEN
        !          12835: 2dup dd-buffer-dma @ swap dma-map-out
        !          12836: dma-free
1.1       root     12837: 0 dd-buffer !
1.1.1.3 ! root     12838: 0 dd-buffer-dma !
1.1       root     12839: THEN
                   12840: cd-buffer @ ?dup IF
1.1.1.3 ! root     12841: BULK-CONFIG-DESCRIPTOR-LEN
        !          12842: 2dup cd-buffer-dma @ swap dma-map-out
        !          12843: dma-free
1.1       root     12844: 0 cd-buffer !
1.1.1.3 ! root     12845: 0 cd-buffer-dma !
1.1       root     12846: THEN
                   12847: ;
1.1.1.3 ! root     12848: : hc-quiesce  ( -- )
1.1       root     12849: 00C3 hccontrol rl!-le             \ Suspend USB host controller
1.1.1.3 ! root     12850: hchcca hchcca-dma OHCI-GLOBAL-DMA-BUF-SIZE dma-map-out
        !          12851: hchcca OHCI-GLOBAL-DMA-BUF-SIZE dma-free
1.1       root     12852: ;
1.1.1.3 ! root     12853: ' hc-quiesce add-quiesce-xt     \ Assert that HC will be supsended
1.1       root     12854: : open  ( -- TRUE|FALSE )
1.1.1.3 ! root     12855: instance-count dup 0= IF
        !          12856: s" OHCI First open" usb-debug-print
1.1       root     12857: (allocate-mem)
1.1.1.3 ! root     12858: THEN
        !          12859: 1 + TO instance-count
        !          12860: s" OHCI Open instance count now: " instance-count usb-debug-print-val
1.1       root     12861: TRUE
                   12862: ;
                   12863: : close  ( -- )
1.1.1.3 ! root     12864: instance-count dup 1 = IF
        !          12865: s" OHCI Last close" usb-debug-print
1.1       root     12866: (de-allocate-mem)
1.1.1.3 ! root     12867: THEN
        !          12868: 1 - TO instance-count
        !          12869: s" OHCI Close instance count now: " instance-count usb-debug-print-val
1.1       root     12870: ;
                   12871: : HC-enable-control-list-processing ( -- )
                   12872: hccomstat dup rl@-le 02 or swap rl!-le
                   12873: hccontrol dup rl@-le 10 or swap rl!-le
                   12874: ;
                   12875: : HC-enable-bulk-list-processing ( -- )
                   12876: hccomstat dup rl@-le 04 or swap rl!-le
                   12877: hccontrol dup rl@-le 20 or swap rl!-le
                   12878: ;
                   12879: : HC-enable-interrupt-list-processing ( -- )
                   12880: hccontrol dup rl@-le 04 or swap rl!-le
                   12881: ;
1.1.1.3 ! root     12882: : (HC-ACK-WDH) ( -- )
        !          12883: WDH hcintstat rl!-le
        !          12884: ;
        !          12885: : (HC-CHECK-WDH) ( -- updated? )
        !          12886: hcintstat rl@-le WDH and 0<>
        !          12887: ;
1.1       root     12888: : disable-control-list-processing ( -- )
                   12889: hccontrol dup rl@-le ffffffef and swap rl!-le
                   12890: hccomstat dup rl@-le fffffffd and swap rl!-le
                   12891: ;
                   12892: : disable-bulk-list-processing ( -- )
                   12893: hccontrol dup rl@-le ffffffdf and swap rl!-le
                   12894: hccomstat dup rl@-le fffffffb and swap rl!-le
                   12895: ;
                   12896: : disable-interrupt-list-processing ( -- )
                   12897: hccontrol dup rl@-le fffffffb and swap rl!-le
                   12898: ;
                   12899: 0 VALUE current-toggle
                   12900: : fill-TD-list ( start-toggle addr dlen dp MPS TD-List-Head -- )
                   12901: TO temp1                               ( start-toggle addr dlen dp MPS )
                   12902: TO temp2                               ( start-toggle addr dlen dp )
                   12903: CASE                                   ( start-toggle addr dlen )
                   12904: OHCI-DP-SETUP  OF  TD-DP-SETUP TO temp3 ENDOF ( start-toggle addr dlen )
                   12905: OHCI-DP-IN     OF  TD-DP-IN    TO temp3 ENDOF ( start-toggle addr dlen )
                   12906: OHCI-DP-OUT    OF  TD-DP-OUT   TO temp3 ENDOF ( start-toggle addr dlen )
                   12907: dup            OF  -1          TO temp3       ( start-toggle addr dlen )
                   12908: s" fill-TD-list: Invalid DP specified"   usb-debug-print
                   12909: ENDOF
                   12910: ENDCASE
                   12911: temp3 -1 = IF EXIT THEN                          ( start-toggle addr dlen )
1.1.1.3 ! root     12912: rot                                               ( addr dlen start-toggle )
        !          12913: TO current-toggle swap                            ( dlen addr )
1.1       root     12914: BEGIN
1.1.1.3 ! root     12915: over temp2 >=                                  ( dlen addr TRUE|FALSE )
        !          12916: WHILE                                             ( dlen addr )
        !          12917: dup virt2phys temp1 td>cbptr l!-le             ( dlen addr )
        !          12918: current-toggle 18 lshift                       ( dlen addr current-toggle~ )
        !          12919: DATA0-TOGGLE                                   ( dlen addr current-toggle~ toggle )
        !          12920: CC-FRESH-TD temp3 or or or                     ( dlen addr or-result )
        !          12921: temp1 td>tattr l!-le                           ( dlen addr~  )
        !          12922: dup temp2 1- + virt2phys temp1 td>bfrend l!-le ( dlen addr~  )
        !          12923: temp2 +                                        ( dlen next-addr )
1.1       root     12924: swap temp2 - swap
1.1.1.3 ! root     12925: temp1 td>ntd l@-le phys2virt TO temp1          ( dlen next-addr )
        !          12926: current-toggle                                 ( dlen next-addr current-toggle )
1.1       root     12927: CASE
                   12928: 0 OF 1 TO current-toggle ENDOF
                   12929: 1 OF 0 TO current-toggle ENDOF
                   12930: ENDCASE
                   12931: REPEAT                                   ( dlen addr )
                   12932: over 0<>  IF
1.1.1.3 ! root     12933: dup virt2phys temp1 td>cbptr l!-le    ( dlen addr )
1.1       root     12934: current-toggle 18 lshift              ( dlen addr curent-toggle~ )
                   12935: DATA0-TOGGLE                          ( dlen addr curent-toggle~ toggle )
                   12936: CC-FRESH-TD temp3 or or or            ( dlen addr or-result )
                   12937: temp1 td>tattr l!-le                  ( dlen addr )
1.1.1.3 ! root     12938: + 1- virt2phys temp1 td>bfrend l!-le
1.1       root     12939: ELSE
                   12940: 2drop
                   12941: THEN
                   12942: ;
                   12943: : (td-list-status) ( PointerToTDlist -- failingTD CCode TRUE | 0 )
                   12944: BEGIN   ( PointerToTDlist )
                   12945: dup 0<>         ( PointerToTDlist TRUE|FALSE )
                   12946: IF              ( PointerToTDlist )
                   12947: dup td>tattr l@-le f0000000 and 1c rshift dup 0= TRUE swap
                   12948: ELSE
                   12949: drop FALSE dup ( FALSE )
                   12950: THEN
                   12951: WHILE
1.1.1.3 ! root     12952: drop drop td>ntd l@-le phys2virt
1.1       root     12953: REPEAT
                   12954: ;
                   12955: : (wait-for-done-q)           ( timeout -- TD-list TRUE | FALSE )
                   12956: BEGIN                      ( timeout )
                   12957: dup 0<>                 ( timeout TRUE|FALSE )
                   12958: (HC-CHECK-WDH) NOT      ( timeout TRUE|FALSE TRUE|FALSE )
                   12959: AND                     \ not timed out AND WDH-bit not set
                   12960: WHILE
                   12961: 1 ms                    \ wait
                   12962: 1-                      ( timeout )
                   12963: dup ff and 0= IF show-proceed THEN
1.1.1.3 ! root     12964: REPEAT                     ( timeout )
1.1       root     12965: drop
1.1.1.3 ! root     12966: hchccadneq l@-le phys2virt    \ read last HcDoneHead (RAM)
        !          12967: (HC-CHECK-WDH)                \ HcDoneHead was updated ?
1.1       root     12968: IF
1.1.1.3 ! root     12969: (HC-ACK-WDH)               \ clear register bit: WDH
        !          12970: TRUE                       ( td-list TRUE )
1.1       root     12971: ELSE
                   12972: FALSE
                   12973: THEN
                   12974: ;
                   12975: : debug-td ( -- )
                   12976: s" Num Free TDs = " num-free-tds usb-debug-print-val
                   12977: ;
                   12978: : HC-reset ( -- )
                   12979: hcrhdescA rl@-le ff and     ( total-rh-ports )
                   12980: to max-rh-ports
                   12981: hcrhpstat TO current-stat              \ start with first port status reg
                   12982: 0                                      \ port status default
                   12983: max-rh-ports 0                         \ checking all ports
1.1.1.3 ! root     12984: ?DO
1.1       root     12985: current-stat rl@-le or              \ OR-ing all stats
                   12986: 200 current-stat rl!-le             \ Clear Port Power (CPP)
                   12987: current-stat 4 + TO current-stat    \ check next RH-Port
                   12988: LOOP
                   12989: 100 and 0<>                            \ any of the ports had power ?
                   12990: IF
                   12991: d# 750 wait-proceed                 \ wait for power discharge
                   12992: THEN
1.1.1.3 ! root     12993: hccomstat dup rl@-le 01 or swap rl!-le    \ issue HC reset
        !          12994: BEGIN
        !          12995: hccomstat rl@-le 01 and 0<>            \ wait for reset end
        !          12996: WHILE
        !          12997: REPEAT
        !          12998: 23f02edf hcintrval rl!-le                 \ frame-interval register
        !          12999: hchcca-dma hchccareg rl!-le               \ HC communication area
        !          13000: 0000     hcctrhead rl!-le                 \ control transfer head
        !          13001: 0000     hcbulkhead rl!-le                \ bulk transfer head
        !          13002: 0ffff    hcintdsbl rl!-le                 \ interrupt disable reg.
        !          13003: 83       hccontrol rl!-le                 \ set USBOPERATIONAL
        !          13004: 23f02edf hcintrval rl!-le                 \ frame-interval register
        !          13005: hchcca-dma hchccareg rl!-le               \ HC communication area
        !          13006: d# 50 ms
1.1       root     13007: hcrhpstat TO current-stat              \ start with first port status reg
                   13008: max-rh-ports 0
1.1.1.3 ! root     13009: ?DO
1.1       root     13010: 102 current-stat rl!-le             \ power on and enable
1.1.1.3 ! root     13011: hcrhdescA rl@-le 18 rshift 2 * ms   \ startup delay 30 ms (2 * POTPGT)
1.1       root     13012: current-stat 4 + TO current-stat    \ check next RH-Port
                   13013: LOOP
                   13014: d# 500 wait-proceed                    \ STEC device needs 300 ms
                   13015: ;
                   13016: : error-recovery ( -- )
                   13017: initialize-td-free-list
                   13018: initialize-ed-free-list
                   13019: HC-reset
                   13020: ;
                   13021: : store-initial-usb-hub-address ( -- )
                   13022: usb-address TO initial-hub-address
                   13023: ;
                   13024: : reset-to-initial-usb-hub-address ( -- )
                   13025: initial-hub-address TO usb-address
                   13026: ;
                   13027: : allocate-usb-address ( -- usb-address )
                   13028: usb-address    7f <>           ( TRUE|FALSE )
                   13029: IF
                   13030: usb-address 1+ TO usb-address \ RISK: Check to see IF it overflows 127
                   13031: usb-address            ( usb-address )
                   13032: THEN                           ( usb-address )
                   13033: ;
                   13034: s" usb-support.fs" INCLUDED
                   13035: : control-std-set-address        ( speedbit -- usb-address TRUE | FALSE )
                   13036: >r                                                 ( R: speedbit )
                   13037: 0005000000000000 setup-packet !
                   13038: allocate-usb-address dup setup-packet 2 + c!       ( usb-addr  R: speedbit )
                   13039: s" USB set-address: " 2 pick usb-debug-print-val   ( usb-addr  R: speedbit )
                   13040: 0 0 0 setup-packet 8 r> controlxfer                ( usb-addr TRUE | FALSE )
                   13041: IF                                                   ( TRUE | FALSE )
                   13042: TRUE                                         ( TRUE )
                   13043: ELSE
                   13044: drop FALSE \ PENDING: Return the allocated address back. ( FALSE )
                   13045: THEN                                                 ( TRUE | FALSE )
                   13046: ;
                   13047: : control-std-get-device-descriptor
                   13048: 8006000100000000 setup-packet !
                   13049: 2 pick setup-packet 6 + w!-le
                   13050: setup-packet -rot ( data-buffer data-len setup-packet MPS fa )
                   13051: >r >r >r >r >r 0 r> r> r> r> r>
                   13052: controlxfer         ( TRUE | FALSE )
                   13053: ;
                   13054: : control-std-get-configuration-descriptor
                   13055: TO temp1 ( data-buffer data-len MPS )
                   13056: TO temp2 ( data-buffer data-len )
                   13057: TO temp3 ( data-buffer )
                   13058: 8006000200000000 setup-packet !
                   13059: temp3 setup-packet 6 + w!-le
                   13060: 0 swap temp3 setup-packet temp2 temp1 controlxfer
                   13061: ;
                   13062: : control-std-get-maxlun ( MPS fun-addr dir data-buff data-len -- TRUE | FALSE )
                   13063: GET-MAX-LUN setup-packet !  ( MPS fun-addr dir data-buff data-len )
                   13064: setup-packet 5 pick 5 pick
                   13065: controlxfer ( MPS fun-addr  TRUE | FALSE )
                   13066: nip nip    ( TRUE | FALSE )
                   13067: ;
                   13068: : control-bulk-reset ( MPS fun-addr dir data-buff data-len -- TRUE | FALSE )
                   13069: 21FF000000000000 setup-packet !  ( MPS fun-addr dir data-buff data-len )
                   13070: setup-packet 5 pick 5 pick
                   13071: controlxfer ( MPS fun-addr  TRUE | FALSE )
                   13072: nip nip    ( TRUE | FALSE )
                   13073: ;
                   13074: : control-std-get-string-descriptor
                   13075: TO temp1  ( StringIndex data-buffer data-len MPS )
                   13076: TO temp2  ( StringIndex data-buffer data-len )
                   13077: TO temp3  ( StringIndex )
                   13078: 8006000300000000 setup-packet !
                   13079: temp3 setup-packet 6 + w!-le
                   13080: 409 setup-packet 4 + w!-le \ US English Language code.
                   13081: swap      ( data buffer StringIndex )
                   13082: setup-packet 2 + c! ( data-buffer )
                   13083: 0 swap temp3 setup-packet temp2 temp1 controlxfer ( TRUE | FALSE )
                   13084: ;
                   13085: : control-std-set-configuration ( configvalue FuncAddr -- TRUE|FALSE )
                   13086: TO temp1                     ( configvalue )
                   13087: TO temp2
                   13088: 0009000000000000 setup-packet ! \ RISK: Endian and 64-bit assumptions
                   13089: temp2 setup-packet 2 + w!-le
                   13090: 0 0 0 setup-packet DEFAULT-CONTROL-MPS temp1 controlxfer
                   13091: ;
                   13092: 0 VALUE port-number
                   13093: s" usb-enumerate.fs" INCLUDED
                   13094: : rhport-enumerate ( port-num -- )
                   13095: TO port-number
                   13096: device-speed control-std-set-address        ( usb-addr TRUE | FALSE )
                   13097: IF
                   13098: device-speed or                          ( usb-addr+speedbit )
                   13099: TO new-device-address
                   13100: dd-buffer @ 8 erase
                   13101: dd-buffer @ DEFAULT-CONTROL-MPS DEFAULT-CONTROL-MPS      ( buffer mps mps )
                   13102: new-device-address control-std-get-device-descriptor   ( TRUE | FALSE )
                   13103: IF
                   13104: ELSE
                   13105: s" USB: Read Dev Descriptor failed"   usb-debug-print EXIT
                   13106: THEN
                   13107: dd-buffer @ DEVICE-DESCRIPTOR-TYPE-OFFSET + c@  ( Descriptor-type )
                   13108: DEVICE-DESCRIPTOR-TYPE <> IF
                   13109: s" USB: Error Reading Device Descriptor"   usb-debug-print
1.1.1.3 ! root     13110: s" Read descriptor is not of the right type"  usb-debug-print
1.1       root     13111: s" Aborting enumeration"  usb-debug-print
                   13112: EXIT
                   13113: THEN
                   13114: dd-buffer @ DEVICE-DESCRIPTOR-MPS-OFFSET + c@ TO mps
                   13115: create-usb-device-tree
                   13116: ELSE
                   13117: s" Set address failed on port " port-number usb-debug-print-val
                   13118: s" Aborting Enumeration."   usb-debug-print
                   13119: EXIT
                   13120: THEN
                   13121: ;
                   13122: : rhport-initialize ( -- )
                   13123: hcrhpstat TO current-stat              \ start with first port status reg
                   13124: max-rh-ports 1+ 1
1.1.1.3 ! root     13125: ?DO
        !          13126: usb-debug-flag IF
        !          13127: ." Initializing RH port " i . cr
        !          13128: THEN
1.1       root     13129: current-stat rl@-le RHP-CCS and 0<>    ( TRUE|FALSE )
                   13130: IF
                   13131: s" Device connected to this port!" usb-debug-print
                   13132: RHP-PRS current-stat rl!-le      \ issue a port reset
                   13133: BEGIN
                   13134: current-stat rl@-le RHP-PRS AND    \ wait for reset end
                   13135: WHILE
                   13136: REPEAT
1.1.1.3 ! root     13137: hcrhdescA rl@-le 18 rshift 2 * ms     \ startup delay 30 ms (POTPGT)
1.1       root     13138: d# 100 ms
                   13139: current-stat rl@-le 200 and 4 lshift
                   13140: to device-speed                  \ store speed bit
                   13141: RHP-CSC RHP-PRSC or current-stat rl!-le
                   13142: I ['] rhport-enumerate CATCH IF  \ Scan port
                   13143: s" USB scan failed on root hub port: " rot usb-debug-print-val
                   13144: reset-to-initial-usb-hub-address
                   13145: THEN
                   13146: ELSE
                   13147: s" No device detected at this port." usb-debug-print
1.1.1.3 ! root     13148: current-stat rl@-le 80000 and 0<>      \ is over-current detected ?
1.1       root     13149: IF
1.1.1.3 ! root     13150: s" Warning: Overcurrent indicated" usb-debug-print
1.1       root     13151: THEN
                   13152: THEN
                   13153: current-stat 4 + TO current-stat    \ check next RH-Port
                   13154: LOOP
                   13155: ;
                   13156: : enumerate ( -- )
                   13157: HC-reset
                   13158: store-initial-usb-hub-address
                   13159: rhport-initialize                 \ Probe all available RH ports
                   13160: reset-to-initial-usb-hub-address
                   13161: ;
1.1.1.3 ! root     13162: ��������=<�0usb-support.fs0 value NEXT-TD
1.1       root     13163: 0 VALUE num-tds
                   13164: 0 VALUE td-retire-count
                   13165: 0 VALUE saved-tail
                   13166: 0 VALUE poll-timer
                   13167: VARIABLE controlxfer-cmd
                   13168: : (ed-prepare) ( dir addr dlen setup-packet MPS ep-fun --
                   13169: FALSE | dir addr dlen ed-ptr setup-ptr )
1.1.1.3 ! root     13170: allocate-ed ?dup 0= IF
        !          13171: s" allocate-ed failed!" usb-debug-print
        !          13172: 4drop 2drop FALSE EXIT  ( FALSE )
        !          13173: THEN                   ( dir addr dlen setup-packet MPS ep-fun ed-ptr )
1.1       root     13174: TO temp1               ( dir addr dlen setup-packet MPS ep-fun )
                   13175: temp1 zero-out-an-ed-except-link ( dir addr dlen setup-packet MPS ep-fun )
                   13176: temp1 ed>eattr l@-le or temp1 ed>eattr l!-le ( dir addr dlen setup-ptr MPS )
                   13177: dup TO temp2 10 lshift temp1 ed>eattr l@-le or temp1 ed>eattr l!-le
                   13178: temp1 swap TRUE            ( dir addr dlen ed-ptr setup-ptr TRUE )
                   13179: ;
                   13180: : (td-prepare) ( dir addr dlen ed-ptr setup-ptr --
                   13181: dir FALSE | dir addr dlen ed-ptr setup-ptr td-head td-tail )
                   13182: 2 pick         ( dir addr dlen ed-ptr setup-ptr dlen )
                   13183: temp2          ( dir addr dlen ed-ptr setup-ptr dlen MPS )
                   13184: /mod           ( dir addr dlen ed-ptr setup-ptr rem quo )
                   13185: swap 0<>   IF  ( dir addr dlen ed-ptr setup-ptr quo )
                   13186: 1+
                   13187: THEN
                   13188: 2+
                   13189: dup TO num-tds                ( dir addr dlen ed-ptr setup-ptr quo+2 )
                   13190: allocate-td-list dup 0=  IF   ( dir addr dlen ed-ptr setup-ptr quo+2 )
                   13191: 2drop                      ( dir addr dlen ed-ptr setup-ptr )
                   13192: drop                       ( dir addr dlen ed-ptr )
                   13193: free-ed                    ( dir addr dlen )
                   13194: 2drop                      ( dir )
                   13195: FALSE                      ( dir FALSE )
                   13196: EXIT
                   13197: THEN TRUE
                   13198: ;
1.1.1.3 ! root     13199: : (td-ready)  ( ed-ptr setup-ptr td-head td-tail -- ed-ptr setup-ptr )
        !          13200: swap virt2phys swap virt2phys   \ Convert td-head and td-tail to physical
        !          13201: 3 pick                      ( ed-ptr s-ptr td-head' td-tail' ed-ptr )
        !          13202: tuck                        ( ed-ptr s-ptr td-head' ed-ptr td-tail' ed-ptr )
        !          13203: ed>tdqtp l!-le              ( ed-ptr s-ptr td-head' ed-ptr )
        !          13204: ed>tdqhp l!-le              ( ed-ptr s-ptr )
        !          13205: over ed>ned 0 swap l!-le    ( ed-ptr s-ptr )
1.1       root     13206: ;
                   13207: : (td-setup-status) ( dir addr dlen ed-ptr setup-ptr -- dir addr dlen ed-ptr )
1.1.1.3 ! root     13208: over ed>tdqhp l@-le phys2virt   ( dir addr dlen ed-ptr setup-ptr td-head )
1.1       root     13209: dup zero-out-a-td-except-link   ( dir addr dlen ed-ptr setup-ptr td-head )
                   13210: dup td>tattr DATA0-TOGGLE CC-FRESH-TD or swap l!-le
1.1.1.3 ! root     13211: 2dup swap virt2phys swap td>cbptr l!-le 
        !          13212: 2dup td>bfrend swap STD-REQUEST-SETUP-SIZE 1- + virt2phys swap l!-le
1.1       root     13213: 2drop                           ( dir addr dlen ed-ptr )
                   13214: ;
                   13215: : (td-tailpointer) ( dir addr dlen ed-ptr -- dir addr dlen ed-ptr )
1.1.1.3 ! root     13216: dup ed>tdqtp l@-le phys2virt    ( dir addr dlen ed-ptr td-tail )
1.1       root     13217: dup zero-out-a-td-except-link   ( dir addr dlen ed-ptr td-tail )
                   13218: dup td>tattr dup l@-le DATA1-TOGGLE CC-FRESH-TD or or swap l!-le
                   13219: 4 pick 0=                       ( dir addr dlen ed-ptr td-tail flag )
                   13220: 3 pick 0<>                      ( dir addr dlen ed-ptr td-tail flag flag )
                   13221: and   IF                        ( dir addr dlen ed-ptr td-tail )
                   13222: dup td>tattr dup l@-le TD-DP-OUT or swap l!-le
                   13223: ELSE
                   13224: dup td>tattr dup l@-le TD-DP-IN or swap l!-le
                   13225: THEN
                   13226: drop                           ( dir addr dlen ed-ptr )
                   13227: ;
                   13228: : (td-data) ( dir addr dlen ed-ptr --  ed-ptr )
                   13229: -rot             ( dir ed-ptr addr dlen )
                   13230: dup 0<>  IF      ( dir ed-ptr addr dlen )
                   13231: >r >r >r TO temp1 r> r> r> temp1 ( ed-ptr addr dlen dir )
1.1.1.3 ! root     13232: 3 pick                        ( ed-ptr addr dlen dir ed-ptr )
        !          13233: ed>tdqhp l@-le phys2virt      ( ed-ptr addr dlen dir tdqhp )
        !          13234: td>ntd l@-le phys2virt        ( ed-ptr addr dlen dir td-datahead )
        !          13235: 4 pick                        ( ed-ptr addr dlen dir td-datahead ed-ptr )
        !          13236: td>tattr l@-le 10 rshift      ( ed-ptr addr dlen dir td-head-data MPS )
        !          13237: swap                          ( ed-ptr addr dlen dir MPS td-head-data )
1.1       root     13238: >r >r >r >r >r 1 r> r> r> r> r>
                   13239: >r >r 0=  IF                 ( ed-ptr 1 addr dlen dir )
                   13240: OHCI-DP-IN                ( ed-ptr 1 addr dlen dir  OHCI-DP-IN )
                   13241: ELSE
                   13242: OHCI-DP-OUT               ( ed-ptr 1 addr dlen dir  OHCI-DP-OUT )
                   13243: THEN
                   13244: r> r>               ( ed-ptr 1 addr dlen dir  OHCI-DP- MPS td-head-data )
                   13245: fill-TD-list
                   13246: ELSE
                   13247: 2drop nip           ( ed-ptr )
                   13248: THEN
                   13249: ;
                   13250: 10 CONSTANT max-retire-td
                   13251: : (transfer-wait-for-doneq)  ( ed-ptr -- TRUE | FALSE )
1.1.1.3 ! root     13252: dup virt2phys                     ( ed-ptr ed-ptr-dma )
1.1       root     13253: hcctrhead rl!-le                  ( ed-ptr )
                   13254: HC-enable-control-list-processing ( ed-ptr )
                   13255: 0 TO td-retire-count              ( ed-ptr )
                   13256: 0 TO poll-timer                   ( ed-ptr )
                   13257: BEGIN
                   13258: td-retire-count num-tds <>     ( ed-ptr TRUE | FALSE )
                   13259: poll-timer max-retire-td < and       ( ed-ptr TRUE | FALSE )
                   13260: WHILE
1.1.1.3 ! root     13261: (HC-CHECK-WDH)                                      ( ed-ptr updated? )
1.1       root     13262: IF
1.1.1.3 ! root     13263: hchccadneq l@-le phys2virt
        !          13264: find-td-list-tail-and-size nip                   ( ed-ptr n )
1.1       root     13265: td-retire-count + TO td-retire-count             ( ed-ptr )
1.1.1.3 ! root     13266: hchccadneq l@-le phys2virt dup     ( ed-ptr done-td done-td )
        !          13267: (td-list-status)                   ( ed-ptr done-td failed-td CCcode )
1.1       root     13268: IF
                   13269: dup >r
                   13270: s" (transfer-wait-for-doneq: USB device communication error."
                   13271: usb-debug-print                 ( ed-ptr done-td failed-td CCcode R: CCcode )
                   13272: dup 4 = swap dup 5 = rot or     ( ed-ptr done-td failed-td CCcode R: CCcode )
                   13273: IF
                   13274: max-retire-td TO poll-timer ( ed-ptr done-td failed-td CCcode R: CCcode )
                   13275: THEN
                   13276: usb-debug-flag
                   13277: IF
                   13278: s" CC code ->" type . cr
                   13279: s" Failing TD contents:" type cr display-td
                   13280: ELSE
                   13281: 2drop
                   13282: THEN                           ( ed-ptr done-td R: CCcode )
                   13283: controlxfer-cmd @ GET-MAX-LUN = r> 4 = and
                   13284: IF
                   13285: s" (transfer-wait-for-doneq): GET-MAX-LUN ControlXfer STALLed"
                   13286: usb-debug-print
                   13287: ELSE
                   13288: drop
                   13289: 5030 error" (USB) Device communication error."
                   13290: ABORT
                   13291: THEN
                   13292: THEN                              ( ed-ptr done-td )
                   13293: (free-td-list)                    ( ed-ptr )
                   13294: 0 hchccadneq l!-le                ( ed-ptr )
1.1.1.3 ! root     13295: (HC-ACK-WDH) \ TDs were written to done queue. ACK the HC.
1.1       root     13296: THEN
                   13297: poll-timer 1+ TO poll-timer
                   13298: 4 ms              \ longer  1 ms
                   13299: REPEAT                                  ( ed-ptr )
                   13300: disable-control-list-processing         ( ed-ptr )
                   13301: td-retire-count num-tds <>              ( ed-ptr )
                   13302: IF
                   13303: dup display-descriptors              ( ed-ptr )
1.1.1.3 ! root     13304: s" maximum of retire " usb-debug-print
1.1       root     13305: THEN
                   13306: free-ed
                   13307: td-retire-count num-tds <>
                   13308: IF
                   13309: FALSE                                ( FALSE )
                   13310: ELSE
                   13311: TRUE                                 ( TRUE )
                   13312: THEN
                   13313: ;
                   13314: : controlxfer ( dir addr dlen setup-packet MPS ep-fun -- TRUE | FALSE )
                   13315: 2 pick @ controlxfer-cmd !
                   13316: (ed-prepare)       ( FALSE | dir addr dlen ed-ptr setup-ptr  )
                   13317: invert IF FALSE EXIT THEN
                   13318: (td-prepare)       ( pt ed-type toggle buffer length mps head )
                   13319: invert IF FALSE EXIT THEN
                   13320: (td-ready)         ( dir addr dlen ed-ptr setup-ptr )
                   13321: (td-setup-status)  ( dir addr dlen ed-ptr )
                   13322: (td-tailpointer)   ( dir addr dlen ed-ptr )
                   13323: (td-data)          ( ed-ptr )
1.1.1.3 ! root     13324: dup ed>tdqtp l@-le phys2virt TO saved-tail    ( ed-ptr )
        !          13325: dup ed>tdqtp 0 swap l!-le                     ( ed-ptr )
        !          13326: (transfer-wait-for-doneq)                     ( TRUE | FALSE )
1.1       root     13327: ;
                   13328: 0201000000000000 CONSTANT CLEARHALTFEATURE
                   13329: 0 VALUE endpt-num
                   13330: 0 VALUE usb-addr-contr-req
                   13331: : control-std-clear-feature ( endpoint-nr usb-addr -- TRUE|FALSE )
                   13332: TO usb-addr-contr-req                        \ usb address
                   13333: TO endpt-num                                 \ endpoint number
                   13334: CLEARHALTFEATURE setup-packet !
                   13335: endpt-num setup-packet 4 + c!                \ endpoint number
                   13336: 0 0 0 setup-packet DEFAULT-CONTROL-MPS usb-addr-contr-req controlxfer
1.1.1.3 ! root     13337: ;
1.1       root     13338: 21FF000000000000 CONSTANT BULK-RESET
                   13339: : control-std-bulk-reset ( usb-addr -- TRUE|FALSE )
                   13340: TO usb-addr-contr-req
                   13341: BULK-RESET setup-packet !
                   13342: 0 0 0 setup-packet DEFAULT-CONTROL-MPS usb-addr-contr-req controlxfer
                   13343: ;
                   13344: : bulk-reset-recovery-procedure ( bulk-out-endp bulk-in-endp usb-addr -- )
                   13345: >r                                          ( bulk-out-endp bulk-in-endp R: usb-addr )
                   13346: r@ control-std-bulk-reset
1.1.1.3 ! root     13347: IF s" bulk reset OK"
        !          13348: ELSE s" bulk reset failed"
1.1       root     13349: THEN usb-debug-print
                   13350: 80 or r@ control-std-clear-feature
1.1.1.3 ! root     13351: IF s" control-std-clear IN endpoint OK"
        !          13352: ELSE s" control-std-clear-IN endpoint failed"
1.1       root     13353: THEN usb-debug-print
                   13354: r@ control-std-clear-feature
1.1.1.3 ! root     13355: IF s" control-std-clear OUT endpoint OK"
        !          13356: ELSE s" control-std-clear-OUT endpoint failed"
1.1       root     13357: THEN usb-debug-print
                   13358: r> drop
                   13359: ;
                   13360: 0 VALUE saved-rw-ed
                   13361: 0 VALUE num-rw-tds
                   13362: 0 VALUE num-rw-retired-tds
                   13363: 0 VALUE saved-rw-start-toggle
                   13364: 0 VALUE saved-list-type
                   13365: : (ed-prepare-rw)
                   13366: ( pt ed-type toggle buffer length mps address ed-ptr --
1.1.1.3 ! root     13367: FALSE | pt ed-type toggle buffer length mps TRUE )
1.1       root     13368: allocate-ed dup 0=  IF
                   13369: drop 2drop 2drop 2drop drop
                   13370: saved-rw-start-toggle FALSE EXIT  ( toggle FALSE )
                   13371: THEN
                   13372: TO saved-rw-ed             ( pt ed-type toggle buffer length mps address )
                   13373: saved-rw-ed zero-out-an-ed-except-link
                   13374: saved-rw-ed ed>eattr l!-le   ( pt ed-type toggle buffer length mps )
                   13375: dup 10 lshift saved-rw-ed ed>eattr l@-le or
                   13376: saved-rw-ed ed>eattr l!-le TRUE  ( pt ed-type toggle buffer length mps TRUE )
                   13377: ;
                   13378: : (td-prepare-rw)
                   13379: ( pt ed-type toggle buffer length mps --
1.1.1.3 ! root     13380: FALSE | pt ed-type toggle buffer length mps head TRUE )
1.1       root     13381: 2dup              ( pt ed-type toggle buffer length mps  length mps )
                   13382: /mod              ( pt ed-type toggle buffer length mps num-tds rem )
                   13383: swap 0<> IF       ( pt ed-type toggle buffer length mps num-tds )
                   13384: 1+             ( pt ed-type toggle buffer length mps num-tds+1 )
                   13385: THEN
                   13386: dup TO num-rw-tds ( pt ed-type toggle buffer length mps num-tds )
                   13387: allocate-td-list  ( pt ed-type toggle buffer length mps head tail )
                   13388: dup 0=  IF
                   13389: 2drop 2drop 2drop 2drop
                   13390: saved-rw-ed free-ed
                   13391: ." rw-endpoint: TD list allocation failed" cr
                   13392: saved-rw-start-toggle FALSE   ( FALSE )
                   13393: EXIT
                   13394: THEN
                   13395: drop  TRUE         ( pt ed-type toggle buffer length mps head TRUE )
                   13396: ;
                   13397: : (td-data-rw)
                   13398: 6 pick                    ( pt ed-type toggle buffer length mps head  pt )
                   13399: FALSE TO case-failed  CASE
                   13400: 0   OF OHCI-DP-IN    ENDOF
                   13401: 1   OF OHCI-DP-OUT   ENDOF
                   13402: 2   OF OHCI-DP-SETUP ENDOF
                   13403: dup OF TRUE TO case-failed
                   13404: ." rw-endpoint: Invalid Packet Type!" cr
                   13405: ENDOF
                   13406: ENDCASE                   ( pt ed-type toggle buffer length mps head dp )
                   13407: case-failed  IF
                   13408: saved-rw-ed free-ed    ( pt ed-type toggle buffer length mps head dp )
                   13409: drop (free-td-list)         ( pt ed-type toggle buffer length mps head )
                   13410: 2drop 2drop 2drop
                   13411: saved-rw-start-toggle FALSE ( FALSE )
                   13412: EXIT                        ( FALSE )
                   13413: THEN
                   13414: -rot                      ( pt ed-type toggle buffer length dp mps head )
                   13415: dup >r                      ( pt ed-type toggle buffer length dp mps head )
                   13416: fill-TD-list r>  TRUE      ( pt et head TRUE )
                   13417: ;
                   13418: : (ed-ready-rw)  ( pt et  -- - | toggle FALSE )
                   13419: nip           ( et )
                   13420: FALSE TO case-failed  CASE
                   13421: 0   OF \ Control List. Queue the ED to control list
                   13422: 0 TO saved-list-type
1.1.1.3 ! root     13423: saved-rw-ed virt2phys hcctrhead rl!-le
1.1       root     13424: HC-enable-control-list-processing
                   13425: ENDOF
                   13426: 1   OF \ Bulk List. Queue the ED to bulk list
                   13427: 1 TO saved-list-type
1.1.1.3 ! root     13428: saved-rw-ed virt2phys hcbulkhead rl!-le
1.1       root     13429: HC-enable-bulk-list-processing
                   13430: ENDOF
                   13431: 2   OF \ Interrupt List.
                   13432: 2 TO saved-list-type
1.1.1.3 ! root     13433: saved-rw-ed virt2phys  hchccareg rl@-le phys2virt  rl!-le
1.1       root     13434: HC-enable-interrupt-list-processing
                   13435: ENDOF
                   13436: dup OF
1.1.1.3 ! root     13437: saved-rw-ed ed>tdqhp l@-le phys2virt (free-td-list)
1.1       root     13438: saved-rw-ed free-ed
                   13439: TRUE TO case-failed
                   13440: ENDOF
                   13441: ENDCASE
                   13442: case-failed  IF
                   13443: saved-rw-start-toggle FALSE ( toggle FALSE )
                   13444: EXIT
                   13445: THEN
                   13446: TRUE                           ( TRUE )
                   13447: ;
                   13448: : (wait-td-retire) ( -- )
                   13449: 0 TO num-rw-retired-tds
                   13450: FALSE TO while-failed
                   13451: BEGIN
                   13452: num-rw-retired-tds num-rw-tds <           ( TRUE | FALSE )
                   13453: while-failed FALSE =  and                 ( TRUE | FALSE )
                   13454: WHILE
                   13455: d# 5000 (wait-for-done-q)                  ( TD-list TRUE|FALSE )
                   13456: IF
                   13457: dup find-td-list-tail-and-size nip         ( td-list size )
                   13458: num-rw-retired-tds + TO num-rw-retired-tds ( td-list )
                   13459: dup (td-list-status)                   ( td-list failed-TD CC )
                   13460: IF
                   13461: dup 4 =
                   13462: IF
                   13463: saved-list-type
                   13464: CASE
                   13465: 0 OF
                   13466: 0 0 control-std-clear-feature
                   13467: s" clear feature " usb-debug-print
                   13468: ENDOF
                   13469: 1 OF                             \ clean bulk stalled
                   13470: s" clear bulk when stalled " usb-debug-print
                   13471: disable-bulk-list-processing   \ disable procesing
                   13472: saved-rw-ed ed>eattr l@-le dup \ extract
                   13473: 780 and 7 rshift 80 or         \ endpoint and
                   13474: swap 7f and                    \ usb addr
                   13475: control-std-clear-feature
                   13476: ENDOF
                   13477: 2 OF
                   13478: 0 saved-rw-ed ed>eattr l@-le
                   13479: control-std-clear-feature
                   13480: ENDOF
                   13481: dup OF
                   13482: s" unknown status " usb-debug-print
                   13483: ENDOF
                   13484: ENDCASE
                   13485: ELSE                             ( td-list failed-TD CC )
                   13486: ."  TD failed  " 5b emit .s 5d emit cr
                   13487: 5040 error" (USB) device transaction error (wait-td-retire)."
                   13488: ABORT
                   13489: THEN
                   13490: 2drop drop
                   13491: TRUE TO while-failed                \ transaction failed
                   13492: NEXT-TD 0<>                         \ clean the TD if we
                   13493: IF
                   13494: NEXT-TD (free-td-list)           \ had a stalled
                   13495: THEN
                   13496: THEN
                   13497: (free-td-list)
                   13498: ELSE
                   13499: drop                                   \ drop td-list pointer
                   13500: scan-time? IF 2e emit THEN             \ show proceeding dots
                   13501: TRUE TO while-failed
                   13502: s" time out wait for done" usb-debug-print
                   13503: 20 ms     \ wait for bad device
                   13504: THEN
                   13505: REPEAT
                   13506: ;
                   13507: : (process-retired-td)   ( -- TRUE | FALSE )
                   13508: saved-list-type  CASE
                   13509: 0 OF disable-control-list-processing ENDOF
                   13510: 1 OF disable-bulk-list-processing ENDOF
                   13511: 2 OF disable-interrupt-list-processing ENDOF
                   13512: ENDCASE
1.1.1.3 ! root     13513: saved-rw-ed ed>tdqhp l@-le 2 and 0<> IF
        !          13514: 1
1.1       root     13515: s" retired 1" usb-debug-print
                   13516: ELSE
1.1.1.3 ! root     13517: 0
1.1       root     13518: s" retired 0" usb-debug-print
                   13519: THEN
                   13520: WHILE-failed   IF
                   13521: FALSE           ( FALSE )
                   13522: ELSE
                   13523: TRUE            ( TRUE )
                   13524: THEN
                   13525: saved-rw-ed free-ed
                   13526: ;
                   13527: : (do-rw-endpoint)
                   13528: 4 pick              ( pt ed-type toggle buffer length mps address toggle )
                   13529: TO saved-rw-start-toggle ( pt ed-type toggle buffer length mps address )
1.1.1.3 ! root     13530: (ed-prepare-rw)     ( FALSE | pt ed-type toggle buffer length mps TRUE )
1.1       root     13531: invert IF FALSE EXIT THEN
1.1.1.3 ! root     13532: (td-prepare-rw)     ( FALSE | pt ed-type toggle buffer length mps head TRUE )
1.1       root     13533: invert IF FALSE EXIT THEN
1.1.1.3 ! root     13534: (td-data-rw)        ( FALSE | pt et head TRUE )
1.1       root     13535: invert IF FALSE EXIT THEN
1.1.1.3 ! root     13536: virt2phys saved-rw-ed ed>tdqhp l!-le  ( pt et )
        !          13537: saved-rw-ed ed>tdqhp l@-le phys2virt
        !          13538: td>ntd l@-le phys2virt  TO NEXT-TD    \ save for a stalled
1.1       root     13539: (ed-ready-rw)
                   13540: invert IF FALSE EXIT THEN
                   13541: (wait-td-retire)
                   13542: (process-retired-td)         ( TRUE | FALSE )
                   13543: ;
                   13544: 0 VALUE transfer-len
                   13545: 0 VALUE mps-current
                   13546: 0 VALUE addr-current
                   13547: 0 VALUE usb-addr
                   13548: 0 VALUE toggle-current
                   13549: 0 VALUE type-current
                   13550: 0 VALUE pt-current
                   13551: 0 VALUE read-status
                   13552: 0 VALUE counter
                   13553: 0 VALUE residue
                   13554: : rw-endpoint
                   13555: 2 pick TO transfer-len  ( pt ed-type toggle buffer length mps address )
                   13556: 1 pick TO mps-current   ( pt ed-type toggle buffer length mps address )
                   13557: TRUE TO read-status     ( pt ed-type toggle buffer length mps address )
                   13558: transfer-len mps-current num-free-tds * <=  IF
                   13559: (do-rw-endpoint)     ( toggle TRUE | toggle FALSE )
                   13560: TO read-status       ( toggle )
                   13561: TO toggle-current
                   13562: ELSE
                   13563: TO usb-addr          ( pt ed-type toggle buffer length mps )
                   13564: 2drop                ( pt ed-type toggle buffer )
                   13565: TO addr-current      ( pt ed-type toggle )
                   13566: TO toggle-current    ( pt ed-type )
                   13567: TO type-current      ( pt )
                   13568: TO pt-current
                   13569: transfer-len mps-current num-free-tds * /mod  ( residue count )
                   13570: TO counter           ( residue )
                   13571: TO residue
                   13572: mps-current num-free-tds * TO transfer-len   BEGIN
                   13573: counter 0 >       ( TRUE | FALSE )
                   13574: read-status TRUE = and   ( TRUE | FALSE )
                   13575: WHILE
                   13576: pt-current type-current toggle-current ( pt ed-type toggle )
                   13577: addr-current transfer-len  ( pt ed-type toggle buffer length )
                   13578: mps-current                ( pt ed-type toggle buffer length mps )
                   13579: usb-addr (do-rw-endpoint)  ( toggle TRUE | toggle FALSE )
                   13580: TO read-status             ( toggle )
                   13581: TO toggle-current
                   13582: addr-current transfer-len + TO addr-current
                   13583: counter 1- TO counter
                   13584: REPEAT
                   13585: residue 0<>                    ( TRUE |FALSE )
                   13586: read-status TRUE = and IF
                   13587: residue TO transfer-len
                   13588: pt-current type-current toggle-current ( pt ed-type toggle )
                   13589: addr-current transfer-len   ( pt ed-type toggle buffer length )
                   13590: mps-current                 ( pt ed-type toggle buffer length mps )
                   13591: usb-addr (do-rw-endpoint)   ( toggle TRUE | toggle FALSE )
                   13592: TO read-status
                   13593: TO toggle-current
                   13594: THEN
                   13595: THEN
                   13596: read-status invert  IF
                   13597: THEN
                   13598: toggle-current                    ( toggle )
                   13599: read-status                       ( TRUE | FALSE )
                   13600: ;
1.1.1.3 ! root     13601: �������� � �0usb-hub.fss" hub" device-name
1.1       root     13602: s" usb" device-type
                   13603: 1 encode-int s" #address-cells" property
                   13604: 0 encode-int s" #size-cells" property
                   13605: : encode-unit ( port-addr -- unit-str unit-len )  1 hex-encode-unit ;
                   13606: : decode-unit ( addr len -- port-addr ) 1 hex-decode-unit ;
                   13607: 0 VALUE new-device-address
                   13608: 0 VALUE port-number
                   13609: 0 VALUE MPS-DCP
                   13610: 0 VALUE mps
                   13611: 0 VALUE my-usb-address
                   13612: 00 value device-speed
                   13613: : mps-property-set ( -- )
                   13614: s"  HUB Compiling mps-property-set " usb-debug-print
                   13615: s" USB-ADDRESS" get-my-property ( TRUE | prop-addr prop-len FALSE )
                   13616: IF
                   13617: s" notpossible" usb-debug-print
                   13618: ELSE
                   13619: decode-int nip nip to my-usb-address
                   13620: THEN  
                   13621: s" MPS-DCP" get-my-property ( TRUE | prop-addr prop-len FALSE )
                   13622: IF 
                   13623: s" MPS-DCP property not found Assuming 8 as MAX PACKET SIZE" ( str len )  
                   13624: usb-debug-print
                   13625: s" for the default control pipe"  usb-debug-print
                   13626: 8 to MPS-DCP
                   13627: ELSE
                   13628: s" MPS-DCP property found!!" usb-debug-print ( prop-addr prop-len FALSE )
                   13629: decode-int nip nip to MPS-DCP
                   13630: THEN
                   13631: ;
                   13632: 2303080000000000 CONSTANT hppwr-set
                   13633: 2301080000000000 CONSTANT hppwr-clear
                   13634: 2303040000000000 CONSTANT hprst-set
                   13635: A300000000000400 CONSTANT hpsta-get
                   13636: 2303010000000000 CONSTANT hpena-set
                   13637: A006002900000000 CONSTANT hubds-get
                   13638: 8  CONSTANT DEFAULT-CONTROL-MPS
                   13639: 12 CONSTANT DEVICE-DESCRIPTOR-LEN
                   13640: 9  CONSTANT CONFIG-DESCRIPTOR-LEN
                   13641: 20 CONSTANT BULK-CONFIG-DESCRIPTOR-LEN
                   13642: 1 CONSTANT DEVICE-DESCRIPTOR-TYPE
                   13643: 1 CONSTANT DEVICE-DESCRIPTOR-TYPE-OFFSET
                   13644: 4 CONSTANT DEVICE-DESCRIPTOR-DEVCLASS-OFFSET
                   13645: 7 CONSTANT DEVICE-DESCRIPTOR-MPS-OFFSET
                   13646: 9 CONSTANT HUB-DEVICE-CLASS
                   13647: 0 CONSTANT NO-CLASS
                   13648: 00 VALUE temp1
                   13649: 00 VALUE temp2
                   13650: 00 VALUE temp3
                   13651: 00 VALUE po2pg            \ Power On to Power Good
1.1.1.3 ! root     13652: : dma-alloc    s" dma-alloc" $call-parent ;
        !          13653: : dma-map-in   s" dma-map-in" $call-parent ;
        !          13654: : dma-map-out  s" dma-map-out" $call-parent ;
        !          13655: : dma-free     s" dma-free" $call-parent ;
        !          13656: 0 INSTANCE VALUE setup-packet     \ 8 bytes for setup packet
        !          13657: 0 INSTANCE VALUE ch-buffer        \ 1 byte character buffer
1.1       root     13658: INSTANCE VARIABLE dd-buffer
                   13659: INSTANCE VARIABLE cd-buffer
1.1.1.3 ! root     13660: STRUCT
        !          13661: 8 FIELD >setup-packet                         \ 8 bytes for setup packet
        !          13662: DEVICE-DESCRIPTOR-LEN FIELD >dd-buffer
        !          13663: BULK-CONFIG-DESCRIPTOR-LEN FIELD >cd-buffer
        !          13664: 8 chars FIELD >status-buffer
        !          13665: 9 chars FIELD >hd-buffer
        !          13666: 1 chars FIELD >ch-buffer                      \ character buffer
        !          13667: CONSTANT /hub-buf
        !          13668: 0 INSTANCE VALUE hub-buf
        !          13669: 0 INSTANCE VALUE hub-buf-phys
1.1       root     13670: : (allocate-mem)  ( -- )
1.1.1.3 ! root     13671: /hub-buf dma-alloc TO hub-buf
        !          13672: hub-buf /hub-buf 0 dma-map-in TO hub-buf-phys
        !          13673: hub-buf >setup-packet TO setup-packet
        !          13674: hub-buf >ch-buffer TO ch-buffer
        !          13675: hub-buf >dd-buffer dd-buffer !
        !          13676: hub-buf >cd-buffer cd-buffer !
        !          13677: s" hub-buf = " hub-buf usb-debug-print-val
1.1       root     13678: ;
                   13679: : (de-allocate-mem)  ( -- )
1.1.1.3 ! root     13680: hub-buf hub-buf-phys /hub-buf dma-map-out
        !          13681: hub-buf /hub-buf dma-free
        !          13682: 0 TO hub-buf
        !          13683: 0 TO hub-buf-phys
        !          13684: 0 TO setup-packet
        !          13685: 0 TO ch-buffer
1.1       root     13686: 0 dd-buffer !
                   13687: 0 cd-buffer !
                   13688: ;
                   13689: : open ( -- TRUE )
                   13690: (allocate-mem)
                   13691: TRUE
                   13692: ;
                   13693: : close ( -- )
                   13694: (de-allocate-mem)
                   13695: ;
                   13696: : controlxfer ( dir addr dlen setup-packet MPS ep-fun -- TRUE|FALSE )
                   13697: s" controlxfer" $call-parent 
                   13698: ;
                   13699: : control-std-set-address ( speedbit -- usb-address TRUE|FALSE )
                   13700: s" control-std-set-address" $call-parent 
                   13701: ; 
                   13702: : control-std-get-device-descriptor 
                   13703: s" control-std-get-device-descriptor" $call-parent 
                   13704: ;
                   13705: : control-std-get-configuration-descriptor 
                   13706: s" control-std-get-configuration-descriptor" $call-parent 
                   13707: ;
                   13708: : control-std-get-maxlun
                   13709: s" control-std-get-maxlun" $call-parent 
                   13710: ;
                   13711: : control-std-set-configuration 
                   13712: s" control-std-set-configuration" $call-parent 
                   13713: ;
                   13714: : control-std-get-string-descriptor
                   13715: s" control-std-get-string-descriptor" $call-parent 
                   13716: ;
                   13717: : rw-endpoint 
                   13718: s" rw-endpoint" $call-parent 
                   13719: ;
                   13720: : debug-td ( -- )
                   13721: s" debug-td" $call-parent
                   13722: ;
                   13723: : control-bulk-reset ( MPS fun-addr dir data-buff data-len -- TRUE | FALSE )
                   13724: s" control-bulk-reset" $call-parent
                   13725: ;
                   13726: : control-hub-port-power-set  ( port# -- TRUE|FALSE )
                   13727: hppwr-set setup-packet !       ( port#)
                   13728: setup-packet 4 + c!
                   13729: 0 0 0 setup-packet MPS-DCP my-usb-address controlxfer ( TRUE | FALSE )
                   13730: ;
                   13731: : control-hub-port-power-clear ( port#-- TRUE|FALSE )
                   13732: hppwr-clear setup-packet !     ( port#)
                   13733: setup-packet 4 + c!
                   13734: 0 0 0 setup-packet MPS-DCP my-usb-address controlxfer ( TRUE|FALSE )
                   13735: ;
                   13736: : control-hub-port-reset-set ( port# -- TRUE|FALSE )
                   13737: hprst-set setup-packet !       ( port# )
                   13738: setup-packet 4 + c!
                   13739: 0 0 0 setup-packet MPS-DCP my-usb-address controlxfer ( TRUE|FALSE )
                   13740: ;
                   13741: : control-hub-port-enable ( port# -- TRUE|FALSE )
                   13742: hpena-set setup-packet !       ( port# )
                   13743: setup-packet 4 +  c!
                   13744: 0 0 0 setup-packet MPS-DCP my-usb-address controlxfer ( TRUE|FALSE )
                   13745: ;
                   13746: : control-hub-port-status-get ( buffer port# -- TRUE|FALSE )
                   13747: hpsta-get setup-packet !       ( buffer port# )
                   13748: setup-packet 4 + c!            ( buffer )
                   13749: 0 swap 4 setup-packet MPS-DCP my-usb-address controlxfer ( TRUE|FALSE )
                   13750: ;
                   13751: : control-get-hub-descriptor ( buffer buffer-length -- TRUE|FALSE )
                   13752: hubds-get setup-packet ! 
                   13753: dup setup-packet 6 + w!-le ( buffer buffer-length )
                   13754: 0 -rot setup-packet MPS-DCP my-usb-address controlxfer ( TRUE|FALSE )
                   13755: ;
                   13756: s" usb-enumerate.fs" INCLUDED
                   13757: : hub-configure-port ( port# -- )
                   13758: BEGIN                          ( port# )
1.1.1.3 ! root     13759: hub-buf >status-buffer 4 erase    ( port# )
        !          13760: hub-buf >status-buffer over
        !          13761: control-hub-port-status-get drop  ( port# ) 
        !          13762: hub-buf >status-buffer w@-le 102 and 0=   ( port# TRUE|FALSE )
1.1       root     13763: WHILE                          ( port# )
1.1.1.3 ! root     13764: REPEAT                               ( port# )
1.1       root     13765: po2pg 3 * ms    \ wait for bPwrOn2PwrGood*3 ms
                   13766: dup control-hub-port-reset-set drop    ( port# )
                   13767: BEGIN                          ( port# )
1.1.1.3 ! root     13768: hub-buf >status-buffer 4 erase    ( port# )
        !          13769: hub-buf >status-buffer over
        !          13770: control-hub-port-status-get drop  ( port# ) 
        !          13771: hub-buf >status-buffer w@-le 10 and  ( port# TRUE|FALSE )
1.1       root     13772: WHILE                          ( port# )
                   13773: REPEAT                         ( port# )
1.1.1.3 ! root     13774: hub-buf >status-buffer 4 erase       ( port# )
        !          13775: hub-buf >status-buffer over
        !          13776: control-hub-port-status-get drop     ( port# ) 
        !          13777: hub-buf >status-buffer w@-le  103 and  103 <>   ( port# TRUE|FALSE )
        !          13778: s" Port status bits: " hub-buf >status-buffer w@-le usb-debug-print-val
1.1       root     13779: IF                                     ( port# ) 
1.1.1.3 ! root     13780: drop
1.1       root     13781: s" Connect status: No device connected "  usb-debug-print
                   13782: EXIT 
                   13783: THEN 
1.1.1.3 ! root     13784: hub-buf >status-buffer w@-le 200 and 4 lshift  \ get speed bit
        !          13785: dup to device-speed                            \ store speed bit
1.1       root     13786: control-std-set-address        ( port# usb-addr TRUE|FALSE )
                   13787: 50 ms                  ( port# usb-addr TRUE|FALSE )
                   13788: debug-td                       ( port# usb-addr TRUE|FALSE )
                   13789: IF                             ( port# usb-addr )
                   13790: device-speed or           ( port# usb-addr+speedbit )
                   13791: to new-device-address     ( port# )
                   13792: to port-number
                   13793: dd-buffer @ DEVICE-DESCRIPTOR-LEN erase
                   13794: dd-buffer @ DEFAULT-CONTROL-MPS DEFAULT-CONTROL-MPS new-device-address
                   13795: control-std-get-device-descriptor     ( TRUE|FALSE )
                   13796: IF
                   13797: dd-buffer @ DEVICE-DESCRIPTOR-TYPE-OFFSET + c@ ( descriptor-type )
                   13798: DEVICE-DESCRIPTOR-TYPE <>          ( TRUE|FALSE )
                   13799: IF 
                   13800: s" HUB: ERROR!! Invalid Device Descriptor for the new device"
                   13801: usb-debug-print
                   13802: ELSE
                   13803: dd-buffer @ DEVICE-DESCRIPTOR-MPS-OFFSET + c@ to mps
                   13804: dd-buffer @ DEVICE-DESCRIPTOR-LEN erase
                   13805: dd-buffer @ DEVICE-DESCRIPTOR-LEN mps new-device-address
                   13806: control-std-get-device-descriptor invert
                   13807: IF
                   13808: s" ** reading dev-descriptor failed ** " usb-debug-print
                   13809: THEN
                   13810: create-usb-device-tree
                   13811: THEN
                   13812: ELSE
                   13813: s" ERROR!! Failed to get device descriptor" usb-debug-print 
                   13814: THEN
                   13815: ELSE                                               ( port# )
                   13816: s" USB Set Adddress failed!!" usb-debug-print ( port# )
                   13817: s" Clearing Port Power..."  usb-debug-print   ( port# )
                   13818: control-hub-port-power-clear               ( TRUE|FALSE )
                   13819: IF 
                   13820: s" Port power down " usb-debug-print
                   13821: ELSE
                   13822: s" Unable to clear port power!!!" usb-debug-print
                   13823: THEN
                   13824: THEN
                   13825: ;
                   13826: : hub-enumerate ( -- )
                   13827: cd-buffer @ CONFIG-DESCRIPTOR-LEN erase
                   13828: cd-buffer @ CONFIG-DESCRIPTOR-LEN MPS-DCP my-usb-address 
                   13829: control-std-get-configuration-descriptor drop 
                   13830: cd-buffer @ 1+ c@ 2 <>  IF
                   13831: s" Unable to read configuration descriptor" usb-debug-print
                   13832: EXIT 
                   13833: THEN 
                   13834: cd-buffer @ 4 + c@ 1 <> IF
                   13835: s" Not a valid HUB config descriptor" usb-debug-print 
                   13836: EXIT 
                   13837: THEN 
                   13838: cd-buffer @ 5 + c@ to temp1 \ Store the configuration in temp1
                   13839: temp1 my-usb-address control-std-set-configuration drop
                   13840: my-usb-address to temp1
1.1.1.3 ! root     13841: hub-buf >hd-buffer 9 erase
        !          13842: hub-buf >hd-buffer 9 control-get-hub-descriptor drop
        !          13843: hub-buf >hd-buffer 2 + c@ to temp2     \ number of downstream ports
1.1       root     13844: s" HUB: Found " usb-debug-print
                   13845: s" number of downstream hub ports! : " temp2 usb-debug-print-val
1.1.1.3 ! root     13846: hub-buf >hd-buffer 5 + c@ to po2pg     \ get bPwrOn2PwrGood
1.1       root     13847: temp2 1+ 1 DO
                   13848: i control-hub-port-power-set drop
                   13849: d# 20 ms
                   13850: LOOP
                   13851: d# 200 ms      \ some devices need a long time (10s)
                   13852: temp2 1+ 1 DO
                   13853: s" hub-configure-port: " i usb-debug-print-val
                   13854: i hub-configure-port
                   13855: LOOP
                   13856: ; 
                   13857: (allocate-mem)
                   13858: mps-property-set
                   13859: hub-enumerate
                   13860: (de-allocate-mem)
1.1.1.3 ! root     13861: ���������8usb-enumerate.fs: (hub-create) ( -- )
1.1       root     13862: mps port-number new-device-address port-number 
                   13863: new-device set-space                ( mps port-number usb-address )
                   13864: encode-int s" USB-ADDRESS" property ( mps port-number )
                   13865: s" Address Set"  usb-debug-print
                   13866: encode-int s" reg" property         ( mps )
                   13867: s" Port Number Set"   usb-debug-print 
                   13868: encode-int s" MPS-DCP" property
                   13869: s" MPS Set"   usb-debug-print
                   13870: s" usb-hub.fs" INCLUDED
                   13871: finish-device
                   13872: ;
                   13873: : (atapi-scsi-property-set) ( -- )
                   13874: dd-buffer @ e + c@     ( Manuf )
                   13875: dd-buffer @ f + c@     ( Manuf Prod )
                   13876: dd-buffer @ 10 + c@    ( Manuf Prod Serial-Num )
                   13877: cd-buffer @ 16 + w@-le ( Manuf Prod Serial-Num ep-mps )
                   13878: cd-buffer @ 14 + c@    ( Manuf Prod Serial-Num ep-mps ep-addr )
                   13879: cd-buffer @ 1d + w@-le ( Manuf Prod Serial-Num ep-mps ep-addr ep-mps )
                   13880: cd-buffer @ 1b + c@    ( Manuf Prod Serial-Num ep-mps ep-addr ep-mps ep-addr )
                   13881: mps port-number new-device-address port-number
                   13882: ( Manuf Prod Serial-Num ep-mps ep-addr ep-mps ep-addr 
                   13883: mps port-num usb-addr port-num )
                   13884: new-device set-space
                   13885: ( Manuf Prod Serial-Num ep-mps ep-addr ep-mps ep-addr
                   13886: mps port-num usb-addr )
                   13887: encode-int s" USB-ADDRESS" property
                   13888: ( Manuf Prod Serial-Num ep-mps ep-addr ep-mps ep-addr
                   13889: mps port-num )
                   13890: encode-int s" reg" property
                   13891: ( Manuf Prod Serial-Num ep-mps ep-addr ep-mps ep-addr 
                   13892: mps )
                   13893: encode-int s" MPS-DCP" property
                   13894: 2 0  DO
                   13895: dup 80 and IF
                   13896: 7f and encode-int
                   13897: s" BULK-IN-EP-ADDR" property
                   13898: encode-int s" MPS-BULKIN" property
                   13899: ELSE
                   13900: encode-int s" BULK-OUT-EP-ADDR" property
                   13901: encode-int s" MPS-BULKOUT" property
                   13902: THEN
                   13903: LOOP                                  ( Manuf Prod Serial-Num )
                   13904: encode-int s" iSerialNumber" property ( Manuf Prod )
                   13905: encode-int s" iProduct" property      ( Manuf )
                   13906: encode-int s" iManufacturer" property
                   13907: ;
                   13908: : (device-classify) 
                   13909: cd-buffer @ BULK-CONFIG-DESCRIPTOR-LEN erase
                   13910: cd-buffer @ BULK-CONFIG-DESCRIPTOR-LEN mps new-device-address 
                   13911: control-std-get-configuration-descriptor
                   13912: IF
                   13913: cd-buffer @ 1+ c@           ( Descriptor-type )
                   13914: 2 =   IF
                   13915: cd-buffer @ 10 + c@      ( protocol )
                   13916: cd-buffer @ f + c@       ( protocol subclass )
                   13917: cd-buffer @ e + c@       ( protocol subclass class )
                   13918: TRUE
                   13919: ELSE
                   13920: s" Not a valid configuration descriptor!!" usb-debug-print
                   13921: FALSE
                   13922: THEN
                   13923: ELSE
                   13924: s" Unable to read configuration descriptor!!" usb-debug-print
                   13925: FALSE
                   13926: THEN
                   13927: ;
                   13928: : (atapi-8020-create) ( -- )
                   13929: (atapi-scsi-property-set)
                   13930: s" usb-storage.fs" INCLUDED
                   13931: finish-device
                   13932: ;
                   13933: : (atapi-8070-create) ( -- )
                   13934: (atapi-scsi-property-set)
                   13935: s" usb-storage.fs" INCLUDED
                   13936: finish-device
                   13937: ;
                   13938: : (scsi-create) ( -- )
                   13939: s" SCSI-CREATE " usb-debug-print
                   13940: dd-buffer @ 8 + w@-le 4b4 =         \ VendorID = CYPRESS ?
                   13941: IF
                   13942: dd-buffer @ a + w@-le 6830 =     \ Device = CY7C68300 ?
                   13943: IF
                   13944: d# 20 ms
                   13945: mps new-device-address 0 0 0   ( MPS fun-addr dir data-buff data-len )
                   13946: control-bulk-reset             ( TRUE|FALSE )
                   13947: d# 100 ms
                   13948: mps new-device-address 0 0 0   ( TRUE|FALSE MPS fun-addr dir data-buff data-len )
                   13949: control-bulk-reset             ( TRUE|FALSE TRUE|FALSE )
                   13950: and invert
                   13951: IF
                   13952: ."   ** BULK-RESET failed **" cr
                   13953: THEN
                   13954: d# 20 ms
                   13955: THEN
                   13956: THEN
1.1.1.3 ! root     13957: 0 ch-buffer c!                \ preset a clean response
1.1       root     13958: mps new-device-address 0 ch-buffer 1 control-std-get-maxlun ( TRUE|FALSE )
                   13959: IF
                   13960: ELSE
                   13961: s" ERROR in GET-MAX-LUN " usb-debug-print
1.1.1.3 ! root     13962: 0 ch-buffer c!             \ clear invalid numbers
1.1       root     13963: cd-buffer @ 5 + c@ to temp1
                   13964: temp1 new-device-address control-std-set-configuration drop
                   13965: THEN
                   13966: 0                       ( counter )
                   13967: begin
                   13968: dup 8 <              ( counter flag )           \ max 8 * 500 ms
                   13969: ch-buffer c@ f >     ( counter flag flag )      \ is MuxLUN above limit ?
                   13970: AND                  ( counter flag )
                   13971: while
                   13972: d# 500 ms                     \ this device is not yet ready
1.1.1.3 ! root     13973: 0 ch-buffer c!                \ preset a clean response
1.1       root     13974: mps new-device-address 0 ch-buffer 1 control-std-get-maxlun ( TRUE|FALSE )
                   13975: not
                   13976: IF
                   13977: s"  ** ERROR in GET-MAX-LUN ** " usb-debug-print
                   13978: drop 10                    \ replace counter to force loop end
                   13979: THEN
                   13980: 1+                ( counter+1 )
                   13981: repeat
                   13982: drop
                   13983: ch-buffer c@ dup 0= swap f > or IF   
                   13984: s" + LUN: " ch-buffer c@  usb-debug-print-val
                   13985: (atapi-scsi-property-set)
                   13986: s" usb-storage.fs" INCLUDED
                   13987: finish-device
                   13988: ELSE
                   13989: s" - LUN: " ch-buffer c@ usb-debug-print-val
                   13990: (atapi-scsi-property-set)
                   13991: s" usb-storage-wrapper.fs" INCLUDED
                   13992: finish-device
                   13993: THEN
                   13994: ;
                   13995: : (classify-storage)  ( interface-protocol interface-subclass -- )
                   13996: s" USB: Mass Storage Device Found!" usb-debug-print
                   13997: swap 50 <> IF
                   13998: s" USB storage: Protocol is not 50." usb-debug-print
                   13999: drop EXIT
                   14000: THEN
                   14001: CASE
                   14002: 02 OF  (atapi-8020-create) s" ATAPI Interface " usb-debug-print ENDOF
                   14003: 05 OF  (atapi-8070-create) s" ATAPI Interface " usb-debug-print ENDOF
                   14004: 06 OF  (scsi-create) s" SCSI Interface " usb-debug-print ENDOF
                   14005: dup OF  s" USB storage: Unsupported sub-class code." usb-debug-print ENDOF
                   14006: ENDCASE
                   14007: ;
                   14008: : (keyboard-create) ( -- )
                   14009: cd-buffer @ 1f + c@                 ( ep-mps )
                   14010: cd-buffer @ 1d + c@                 ( ep-mps ep-addr )  
                   14011: mps port-number new-device-address port-number
                   14012: new-device set-space                 ( ep-mps ep-addr mps port-num usb-addr )
                   14013: encode-int s" USB-ADDRESS" property  ( ep-mps ep-addr mps port-num )
                   14014: encode-int s" reg" property          ( ep-mps ep-addr mps )
                   14015: encode-int s" MPS-DCP" property      ( ep-mps ep-addr )
                   14016: 7f and encode-int s" INT-IN-EP-ADDR" property
                   14017: encode-int s" MPS-INTIN" property
                   14018: new-device-address   \ device-speed
                   14019: s" usb-keyboard.fs" INCLUDED
                   14020: finish-device
                   14021: ;
                   14022: : (mouse-create) ( -- )
                   14023: mps port-number new-device-address port-number
                   14024: new-device set-space                 ( mps port-num usb-addr )
                   14025: encode-int s" USB-ADDRESS" property  ( mps port-num )
                   14026: encode-int s" reg" property          ( mps )
                   14027: encode-int s" MPS-DCP" property
                   14028: s" usb-mouse.fs" INCLUDED
                   14029: finish-device
                   14030: ;
                   14031: : (classify-by-interface) ( -- )
                   14032: (device-classify)  IF
                   14033: CASE
                   14034: 08 OF
                   14035: (classify-storage)
                   14036: ENDOF
                   14037: 03 OF
                   14038: s" USB: HID Found!" usb-debug-print
1.1.1.3 ! root     14039: 01 = IF
1.1       root     14040: case
                   14041: 01 of
                   14042: s" USB keyboard!" usb-debug-print
                   14043: (keyboard-create)
                   14044: endof
                   14045: 02 of
                   14046: s" USB mouse!" usb-debug-print
                   14047: (mouse-create)
                   14048: endof
                   14049: dup of
                   14050: s" USB: unsupported HID!" usb-debug-print
                   14051: endof
                   14052: endcase
                   14053: ELSE
1.1.1.3 ! root     14054: s" USB: unsupported HID protocol " rot usb-debug-print-val
1.1       root     14055: THEN
                   14056: ENDOF
                   14057: dup OF
                   14058: s" USB: unsupported interface type." usb-debug-print
                   14059: 2drop
                   14060: ENDOF
                   14061: ENDCASE
                   14062: THEN
                   14063: ;
                   14064: : create-usb-device-tree ( -- )
                   14065: dd-buffer @ DEVICE-DESCRIPTOR-DEVCLASS-OFFSET + c@    ( Device-class )
                   14066: CASE
                   14067: HUB-DEVICE-CLASS OF s" USB: HUB found"   usb-debug-print
                   14068: (hub-create)
                   14069: ENDOF
                   14070: NO-CLASS  OF
                   14071: (classify-by-interface)
                   14072: ENDOF
                   14073: DUP OF
                   14074: s" USB: Unknown device found." usb-debug-print
                   14075: ENDOF
                   14076: ENDCASE
                   14077: ;
1.1.1.3 ! root     14078: ��������2P20usb-storage.fss" entered usb-storage.fs" usb-debug-print
        !          14079: s" storage" device-name
1.1       root     14080: s" block" device-type
                   14081: 2 encode-int s" #address-cells" property
                   14082: 0 encode-int s" #size-cells" property
                   14083: 8 VALUE mps-bulk-out
                   14084: 8 VALUE mps-bulk-in
                   14085: 8 VALUE mps-dcp
                   14086: 0 VALUE bulk-in-ep
                   14087: 0 VALUE bulk-out-ep
                   14088: 0 VALUE bulk-in-toggle
                   14089: 0 VALUE bulk-out-toggle
                   14090: 0 VALUE lun
                   14091: 0 VALUE my-usb-address
                   14092: INSTANCE VARIABLE ihandle-bulk
                   14093: INSTANCE VARIABLE ihandle-deblocker
                   14094: INSTANCE VARIABLE flag
                   14095: INSTANCE VARIABLE count
1.1.1.3 ! root     14096: 4000 CONSTANT max-transfer
1.1       root     14097: 200   VALUE block-size           \ default (512 Bytes)
                   14098: -1    VALUE max-block-num        \ highest reported block-number
                   14099: 0f CONSTANT SCSI-COMMAND-OFFSET
1.1.1.3 ! root     14100: STRUCT
        !          14101: max-transfer FIELD >read-buffer
        !          14102: 80 FIELD >response-buffer
        !          14103: 40 FIELD >command-buffer
        !          14104: 10 FIELD >csw-buffer
        !          14105: 8  FIELD >cfg-buffer
        !          14106: CONSTANT /dma-buf
        !          14107: 0 VALUE dma-buf
        !          14108: 0 VALUE dma-buf-phys
        !          14109: : (dma-buf-init)  ( -- )
        !          14110: /dma-buf s" dma-alloc" $call-parent TO dma-buf
        !          14111: dma-buf /dma-buf 0 s" dma-map-in" $call-parent TO dma-buf-phys
        !          14112: s" storage dma-buf = " dma-buf usb-debug-print-val
        !          14113: ;
        !          14114: : (dma-buf-free)  ( -- )
        !          14115: dma-buf dma-buf-phys /dma-buf s" dma-map-out" $call-parent
        !          14116: dma-buf /dma-buf s" dma-free" $call-parent
        !          14117: 0 TO dma-buf
        !          14118: 0 TO dma-buf-phys
        !          14119: ;
1.1       root     14120: s" usb-storage-support.fs" INCLUDED
                   14121: 0 VALUE bulk-cnt
                   14122: 0 VALUE bulk-cmd-len
                   14123: 0 VALUE itest
1.1.1.3 ! root     14124: 0 VALUE resp-buffer
        !          14125: 0 VALUE resp-size
1.1       root     14126: : do-bulk-command ( resp-buffer resp-size -- TRUE | FALSE )
                   14127: TO resp-size
                   14128: TO resp-buffer
                   14129: usb-debug-flag
                   14130: IF
1.1.1.3 ! root     14131: dma-buf >command-buffer 0E + c@ TO bulk-cmd-len 
1.1       root     14132: s" cmd-length: " bulk-cmd-len usb-debug-print-val
1.1.1.3 ! root     14133: dma-buf >command-buffer bulk-cmd-len 0E + dump cr
1.1       root     14134: THEN
                   14135: 6 TO bulk-cnt \ 2 old value
                   14136: FALSE dup
                   14137: BEGIN
                   14138: 0=
                   14139: WHILE
                   14140: drop
1.1.1.3 ! root     14141: 1 1 bulk-out-toggle dma-buf >command-buffer 1f mps-bulk-out
1.1       root     14142: my-usb-address bulk-out-ep 7 lshift or
                   14143: rw-endpoint swap                            ( TRUE toggle | FALSE toggle )
                   14144: to bulk-out-toggle                ( TRUE | FALSE )
                   14145: IF
                   14146: s" resp-size : " resp-size usb-debug-print-val
                   14147: resp-size 0<>
                   14148: IF       \ do we need a response ?!
                   14149: 0 1 bulk-in-toggle resp-buffer resp-size mps-bulk-in
                   14150: my-usb-address bulk-in-ep 7 lshift or
                   14151: rw-endpoint swap                       ( TRUE toggle | FALSE toggle )
                   14152: to bulk-in-toggle                      ( TRUE | FALSE )
                   14153: ELSE
                   14154: TRUE
                   14155: THEN
                   14156: IF               \ read the bulk CSW
1.1.1.3 ! root     14157: 0 1 bulk-in-toggle dma-buf >csw-buffer D mps-bulk-in
1.1       root     14158: my-usb-address bulk-in-ep 7 lshift or
                   14159: rw-endpoint swap                    ( TRUE toggle | FALSE toggle )
                   14160: to bulk-in-toggle                   ( TRUE | FALSE )
                   14161: IF
                   14162: s" Command successful." usb-debug-print
                   14163: TRUE dup
                   14164: ELSE
                   14165: s" Command failed in CSW stage" usb-debug-print
                   14166: FALSE dup
                   14167: THEN
                   14168: ELSE
                   14169: s" Command failed while receiving DATA... read CSW..." usb-debug-print
1.1.1.3 ! root     14170: 0 1 bulk-in-toggle dma-buf >csw-buffer D mps-bulk-in
1.1       root     14171: my-usb-address bulk-in-ep 7 lshift or
                   14172: rw-endpoint swap                    ( TRUE toggle | FALSE toggle )
                   14173: to bulk-in-toggle                   ( TRUE | FALSE )
                   14174: IF
                   14175: s" OK evaluate the CSW ..." usb-debug-print
1.1.1.3 ! root     14176: dma-buf >csw-buffer c + c@ dup TO itest
1.1       root     14177: s" CSW Status: " itest usb-debug-print-val
                   14178: dup
                   14179: 2 =
                   14180: IF \ Phase Error
                   14181: s" Phase error do a bulk reset-recovery ..." usb-debug-print
                   14182: bulk-out-ep bulk-in-ep my-usb-address
                   14183: bulk-reset-recovery-procedure
                   14184: THEN
                   14185: 1 =
                   14186: IF \ Command failed
                   14187: s" Command Failed do a bulk-reset-recovery" usb-debug-print
                   14188: bulk-out-ep bulk-in-ep my-usb-address
                   14189: bulk-reset-recovery-procedure
                   14190: THEN
                   14191: THEN
                   14192: FALSE dup
                   14193: THEN
                   14194: ELSE
                   14195: s" Command failed while Sending CBW ..." usb-debug-print
                   14196: FALSE dup
                   14197: THEN
                   14198: bulk-cnt 1 - TO bulk-cnt
                   14199: bulk-cnt 0=
                   14200: IF
                   14201: 2drop FALSE dup
                   14202: THEN
                   14203: REPEAT
                   14204: ;
                   14205: scsi-open
                   14206: usb-debug-flag to scsi-param-debug  \ copy debug flag
                   14207: 24 CONSTANT inquiry-length    \ was 20
                   14208: : inquiry ( -- )
                   14209: s" usb-storage: inquiry" usb-debug-print
1.1.1.3 ! root     14210: dma-buf >command-buffer 1 inquiry-length 80 lun scsi-length-inquiry
1.1       root     14211: build-cbw
1.1.1.3 ! root     14212: inquiry-length dma-buf >command-buffer SCSI-COMMAND-OFFSET +   ( alloc-len address  )
1.1       root     14213: scsi-build-inquiry
1.1.1.3 ! root     14214: dma-buf >response-buffer inquiry-length erase      \ provide clean buffer
        !          14215: dma-buf >response-buffer inquiry-length do-bulk-command
1.1       root     14216: IF
                   14217: s" Successfully read INQUIRY data" usb-debug-print
                   14218: 0d emit space space
1.1.1.3 ! root     14219: dma-buf >response-buffer c@  \ get 'Peripheral Device Type' (PDT)
1.1       root     14220: CASE
                   14221: 0   OF ." BLOCK-DEV: " ENDOF  \ SCSI Block Device
                   14222: 5   OF ." CD-ROM   : " ENDOF
                   14223: 7   OF ." OPTICAL  : " ENDOF
                   14224: e   OF ." RED-BLOCK: " ENDOF  \ SCSI Reduced Block Device
                   14225: dup dup OF ." ? (" . 8 emit 29 emit 2 spaces ENDOF
                   14226: ENDCASE
                   14227: space
1.1.1.3 ! root     14228: dma-buf >response-buffer 8 + 16 encode-string s" ident-str" property
        !          14229: dma-buf >response-buffer .inquiry-text
1.1       root     14230: ELSE
                   14231: 5040 error" (USB) Device transaction error. (inquiry)"
                   14232: ABORT
                   14233: THEN
                   14234: ;
                   14235: : read-capacity ( -- )
                   14236: s" usb-storage: read-capacity" usb-debug-print
1.1.1.3 ! root     14237: dma-buf >command-buffer 1 8  80 lun  scsi-length-read-cap-10
1.1       root     14238: build-cbw 
1.1.1.3 ! root     14239: dma-buf >command-buffer SCSI-COMMAND-OFFSET +      ( address )   
1.1       root     14240: scsi-build-read-cap-10
                   14241: lun 5 lshift
1.1.1.3 ! root     14242: dma-buf >command-buffer SCSI-COMMAND-OFFSET +      ( address )
1.1       root     14243: read-cap-10>reserved1 c!
1.1.1.3 ! root     14244: dma-buf >response-buffer 8 erase          \ provide clean buffer
        !          14245: dma-buf >response-buffer 8 do-bulk-command
1.1       root     14246: IF
                   14247: s" Successfully read READ CAPACITY data" usb-debug-print
                   14248: ELSE
                   14249: 5040 error" (USB) Device transaction error. (capacity)"
                   14250: ABORT
                   14251: THEN
                   14252: ;
                   14253: : test-unit-ready ( -- TRUE | FALSE )
1.1.1.3 ! root     14254: dma-buf >command-buffer 1 0 80 lun scsi-length-test-unit-ready    \ was: 0c
1.1       root     14255: build-cbw
1.1.1.3 ! root     14256: dma-buf >command-buffer SCSI-COMMAND-OFFSET +      ( address )
1.1       root     14257: scsi-build-test-unit-ready                ( cdb -- )
1.1.1.3 ! root     14258: dma-buf >response-buffer 0 do-bulk-command
1.1       root     14259: IF
                   14260: s" Successfully read test unit ready data" usb-debug-print
1.1.1.3 ! root     14261: s" Test Unit STATUS availabe in dma-buf >csw-buffer" usb-debug-print
        !          14262: dma-buf >csw-buffer 0c + c@ 0=  IF
1.1       root     14263: s" Test Unit Command Successfully Executed" usb-debug-print
                   14264: TRUE                             ( TRUE )
                   14265: ELSE
                   14266: s" Test Unit Command Failed to execute" usb-debug-print
                   14267: FALSE                            ( FALSE )
                   14268: THEN
                   14269: ELSE
                   14270: 5040 error" (USB) Device transaction error. (test-unit-ready)"
                   14271: ABORT
                   14272: THEN
                   14273: ;
                   14274: : wait-for-unit-ready            ( -- TRUE|FALSE )
                   14275: s" --> WAIT: test-unit-ready ... " usb-debug-print
                   14276: d# 100                        ( count )   \ up to 10 seconds
                   14277: BEGIN                         ( count )
                   14278: dup 0>                     ( count flag )
                   14279: test-unit-ready      \ dup IF 2b ELSE 2d THEN emit
                   14280: not and    ( count flag )
                   14281: WHILE
                   14282: 1-                         ( count )
                   14283: d# 100 wait-proceed        \ wait 100 ms
                   14284: REPEAT                        ( count )
                   14285: 0=
                   14286: IF
                   14287: s" **  Device not ready **  " usb-debug-print
                   14288: FALSE
                   14289: ELSE
                   14290: TRUE
                   14291: THEN
                   14292: ;
                   14293: : request-sense ( -- )
                   14294: s" request-sense: Command ready." usb-debug-print
1.1.1.3 ! root     14295: dma-buf >command-buffer 1 12 80 lun scsi-length-request-sense
1.1       root     14296: build-cbw
1.1.1.3 ! root     14297: 12 dma-buf >command-buffer SCSI-COMMAND-OFFSET +   ( alloc-len cdb )
        !          14298: scsi-build-request-sense                           ( alloc-len cdb -- )
        !          14299: dma-buf >response-buffer 12 do-bulk-command
1.1       root     14300: IF
                   14301: s" Read Sense data successfully" usb-debug-print
                   14302: ELSE
                   14303: 5040 error" (USB) Device transaction error. (request-sense)"
                   14304: ABORT
                   14305: THEN
                   14306: ;
                   14307: : start ( -- )
1.1.1.3 ! root     14308: dma-buf >command-buffer 1 0 80 lun scsi-length-start-stop-unit
1.1       root     14309: build-cbw
1.1.1.3 ! root     14310: dma-buf >command-buffer SCSI-COMMAND-OFFSET +      ( cdb )
        !          14311: scsi-const-start scsi-build-start-stop-unit        ( state# cdb -- )
        !          14312: dma-buf >response-buffer 0 do-bulk-command
1.1       root     14313: IF
                   14314: s" Start successfully" usb-debug-print
                   14315: ELSE
                   14316: 5040 error" (USB) Device transaction error. (start)"
                   14317: ABORT
                   14318: THEN
                   14319: ;
                   14320: : stop ( -- )
1.1.1.3 ! root     14321: dma-buf >command-buffer 1 0 80 lun scsi-length-start-stop-unit
1.1       root     14322: build-cbw
1.1.1.3 ! root     14323: dma-buf >command-buffer SCSI-COMMAND-OFFSET +      ( cdb )
        !          14324: scsi-const-stop scsi-build-start-stop-unit         ( state# cdb -- )
        !          14325: dma-buf >response-buffer 0 do-bulk-command
1.1       root     14326: IF
                   14327: s" Stop successfully" usb-debug-print
                   14328: ELSE
                   14329: 5040 error" (USB) Device transaction error. (stop)"
                   14330: ABORT
                   14331: THEN
                   14332: ;
                   14333: 0 VALUE temp1
                   14334: 0 VALUE temp2
                   14335: 0 VALUE temp3
                   14336: : seek ( pos-lo pos-hi -- status )
                   14337: 2dup lxjoin max-block-num block-size * >
                   14338: IF
                   14339: ." ** Seek Error: pos too large ("
                   14340: dup . over . ." -> " max-block-num block-size * .
                   14341: ." ) ** " cr
                   14342: -1                   \ see spec-1275 page 183
                   14343: ELSE
                   14344: s" seek" ihandle-deblocker @ $call-method
                   14345: THEN
                   14346: ;
                   14347: : read ( address length -- actual )
                   14348: s" read" ihandle-deblocker @  $call-method
                   14349: ;
                   14350: : read-blocks ( address block# #blocks -- #read-blocks )
                   14351: 2dup + max-block-num >
                   14352: IF
                   14353: ." ** Requested block too large "
                   14354: 2dup + ." (" .d ." -> " max-block-num .d
                   14355: bs emit ." ) ... read aborted **" cr
                   14356: nip nip                       \ leave #blocks on stack
                   14357: ELSE
1.1.1.3 ! root     14358: block-size *
        !          14359: dma-buf >command-buffer      ( address block# transfer-len command-buffer )
1.1       root     14360: 1 2 pick 80 lun 0c build-cbw ( address block# transfer-len )
                   14361: dup to temp1                 ( address block# transfer-len )
                   14362: block-size /                 ( address block# #blocks )
1.1.1.3 ! root     14363: dma-buf >command-buffer      ( address block# #blocks command-addr )
1.1       root     14364: SCSI-COMMAND-OFFSET +        ( address block# #blocks cdb )
1.1.1.3 ! root     14365: scsi-build-read?             ( address cdblength )
        !          14366: dma-buf >command-buffer 0e + c!   \ update bCBWCBLength-field with resulting CDB length
        !          14367: dma-buf >read-buffer temp1   ( address read-buffer transfer-len )
        !          14368: do-bulk-command              ( address )
1.1       root     14369: IF
1.1.1.3 ! root     14370: dma-buf >read-buffer swap temp1    ( read-buffer address transfer-len )
        !          14371: move
1.1       root     14372: s" Read  data successfully" usb-debug-print
                   14373: ELSE
1.1.1.3 ! root     14374: drop
1.1       root     14375: 5040 error" (USB) Device transaction error. (read-blocks)"
                   14376: ABORT
                   14377: THEN
                   14378: temp1 block-size /  ( #read-blocks )
                   14379: THEN
                   14380: ;
                   14381: d# 800 CONSTANT media-ready-retry
                   14382: : make-media-ready ( -- )
                   14383: s" usb-storage: make-media-ready" usb-debug-print
                   14384: 0  flag !
                   14385: 0  count !
                   14386: BEGIN
                   14387: flag @  0=
                   14388: WHILE
                   14389: test-unit-ready IF
                   14390: s" Media ready for access." usb-debug-print
                   14391: 1  flag !
                   14392: ELSE
                   14393: count @  1 +  count !
                   14394: count @ media-ready-retry = IF
                   14395: 1 flag !
                   14396: 5000 error" (USB) Media or drive not ready for this blade."
                   14397: ABORT
                   14398: THEN
                   14399: request-sense
1.1.1.3 ! root     14400: dma-buf >response-buffer scsi-get-sense-ID? ( addr -- false | sense-ID true )
1.1       root     14401: IF
                   14402: ffff00 AND     \ remaining: sense-key ASC
                   14403: CASE
                   14404: 023a00 OF   \ MEDIUM NOT PRESENT (02 3a 00)
                   14405: 5010 error" (USB) No Media found! Check for the drawer/inserted media."
                   14406: ABORT
                   14407: ENDOF
                   14408: 020400 OF   \ LOGICAL DRIVE NOT READY - INITIALIZATION REQUIRED
                   14409: 5010 error" (USB) No Media found! Check for the drawer/inserted media."
                   14410: ABORT
                   14411: ENDOF
                   14412: 033000 OF   \ CANNOT READ MEDIUM - UNKNOWN FORMAT
                   14413: 5020 error" (USB) Unknown media format."
                   14414: ABORT
                   14415: ENDOF
                   14416: ENDCASE
                   14417: THEN
                   14418: THEN
                   14419: d# 10 ms             \ wait maximum 10ms * 800 (=8s)
                   14420: REPEAT
                   14421: usb-debug-flag IF
                   14422: ." make-media-ready finished after "
                   14423: count @ decimal . hex ." tries." cr
                   14424: THEN
                   14425: ;
                   14426: : .showcap
                   14427: space
                   14428: test-unit-ready drop             \ initial command
                   14429: request-sense
1.1.1.3 ! root     14430: dma-buf >response-buffer scsi-get-sense-ID? ( addr -- false | sense-ID true )
1.1       root     14431: IF
                   14432: dup FFFF00 and 023a00 =       ( sense-id flag )
                   14433: IF
                   14434: 023a02 =                   \ see sense-codes SPC-3 clause 4.5.6
                   14435: IF
                   14436: ."  Tray Open!"
                   14437: ELSE
                   14438: ."    No Media"
                   14439: THEN
                   14440: ELSE                          ( sense-id )
                   14441: drop
                   14442: wait-for-unit-ready
                   14443: IF
                   14444: read-capacity
1.1.1.3 ! root     14445: dma-buf >response-buffer scsi-get-capacity-10 space .capacity-text
1.1       root     14446: ELSE
                   14447: request-sense
1.1.1.3 ! root     14448: dma-buf >response-buffer scsi-get-sense-ID? ( addr -- false | sense-ID true )
1.1       root     14449: IF
                   14450: dup ff0000 and 040000 =       \ sense-code = 4 ?
                   14451: IF
                   14452: ." *HW-ERROR*"
                   14453: ELSE
1.1.1.3 ! root     14454: CASE
1.1       root     14455: 023a00 OF ."   No Media " ENDOF
                   14456: 023a02 OF ." Tray Open! " ENDOF
                   14457: dup    OF ."          ? " ENDOF
                   14458: ENDCASE
                   14459: THEN
                   14460: THEN
                   14461: THEN
                   14462: THEN
                   14463: ELSE
                   14464: ."       ??   "
                   14465: THEN
                   14466: ;
                   14467: : init-dev-ready
                   14468: test-unit-ready drop
                   14469: 4 >r                \ loop-counter
                   14470: 0 0
                   14471: BEGIN
                   14472: 2drop
                   14473: request-sense
1.1.1.3 ! root     14474: dma-buf >response-buffer scsi-get-sense-data      ( ascq asc sense-key )
1.1       root     14475: 0<>  r> 1- dup >r 0<> AND          \ loop-counter or sense-key
                   14476: WHILE
                   14477: REPEAT
                   14478: 2drop
                   14479: r> drop
                   14480: ;
                   14481: scsi-close        \ no further scsi words required
                   14482: : (init-block-size)
                   14483: read-capacity
1.1.1.3 ! root     14484: dma-buf >response-buffer l@ dup 0<>
1.1       root     14485: IF
                   14486: to max-block-num        \ highest block-number
                   14487: ELSE
                   14488: -1 to max-block-num     \ indeterminate
                   14489: THEN
1.1.1.3 ! root     14490: dma-buf >response-buffer 4 + 
1.1       root     14491: l@ to block-size
                   14492: s" usb-storage: block-size=" block-size usb-debug-print-val
                   14493: ;
                   14494: : open ( -- TRUE )
                   14495: s" usb-storage: open" usb-debug-print
1.1.1.3 ! root     14496: (dma-buf-init)
1.1       root     14497: ihandle-bulk s" bulk" (open-package)
                   14498: make-media-ready
                   14499: (init-block-size)           \ Init block-size before opening the deblocker
                   14500: ihandle-deblocker s" deblocker" (open-package)
                   14501: s" disk-label" find-package IF  ( phandle )
                   14502: usb-debug-flag IF ." my-args for disk-label = " my-args swap . . cr THEN
                   14503: my-args rot interpose
                   14504: THEN
                   14505: TRUE                        ( TRUE )
                   14506: ;
                   14507: : close  ( -- )
                   14508: ihandle-deblocker (close-package)
                   14509: ihandle-bulk (close-package)
1.1.1.3 ! root     14510: (dma-buf-free)
1.1       root     14511: ;
                   14512: : (init-device-name)  ( -- )
                   14513: init-dev-ready
                   14514: inquiry
1.1.1.3 ! root     14515: dma-buf >response-buffer c@
1.1       root     14516: CASE
                   14517: 1  OF .showcap s" tape"    device-name ENDOF
                   14518: 5  OF .showcap s" cdrom"   device-name s" CDROM found" usb-debug-print ENDOF
                   14519: 0  OF .showcap s" sbc-dev" device-name s" SBC Direct access device" usb-debug-print ENDOF
                   14520: 7  OF .showcap s" optical" device-name s" Optical memory found" usb-debug-print ENDOF
                   14521: 0E OF .showcap s" rbc-dev" device-name s" RBC direct acces device found" usb-debug-print ENDOF
                   14522: ENDCASE
                   14523: ;
                   14524: : (initial-setup)
1.1.1.3 ! root     14525: (dma-buf-init)
1.1       root     14526: ihandle-bulk s" bulk" (open-package)
                   14527: device-init
                   14528: (init-device-name)
                   14529: set-drive-alias
                   14530: 200 to block-size       \ Default block-size, will be overwritten in "open"
                   14531: ihandle-bulk (close-package)
1.1.1.3 ! root     14532: (dma-buf-free)
1.1       root     14533: ;
                   14534: (initial-setup)
1.1.1.3 ! root     14535: s" leaving usb-storage.fs" usb-debug-print
        !          14536: ��������
        !          14537: �8usb-storage-support.fss" entered usb-storage-support.fs" usb-debug-print
        !          14538: : rw-endpoint
1.1       root     14539: s" rw-endpoint" $call-parent
                   14540: ;
                   14541: : controlxfer ( dir addr dlen setup-packet MPS ep-fun --- TRUE|FALSE )
                   14542: s" controlxfer" $call-parent
                   14543: ;
                   14544: : control-std-get-configuration-descriptor
                   14545: s" control-std-get-configuration-descriptor" $call-parent
                   14546: ;
                   14547: : control-std-set-configuration ( configvalue FuncAddr -- TRUE | FALSE )
                   14548: s" control-std-set-configuration" $call-parent   ( TRUE | FALSE )
                   14549: ;
                   14550: : bulk-reset-recovery-procedure ( bulk-out-endp bulk-in-endp usb-addr -- )
                   14551: s" bulk-reset-recovery-procedure" $call-parent
                   14552: ;
                   14553: : build-cbw ( address tag transfer-len direction lun command-len -- )
                   14554: s" build-cbw" ihandle-bulk @ $call-method
                   14555: ;
                   14556: : analyze-csw ( address -- residue tag TRUE | reason FALSE )
                   14557: s" analyze-csw" ihandle-bulk @ $call-method
                   14558: ;
                   14559: : device-init ( -- )
                   14560: s" Starting to initialize usb-storage device" usb-debug-print
                   14561: s" USB-ADDRESS" get-my-property         ( TRUE | propaddr proplen FALSE )
                   14562: IF
                   14563: s" not possible" usb-debug-print
                   14564: ELSE
                   14565: decode-int nip nip to my-usb-address
                   14566: THEN
                   14567: s" MPS-BULKOUT" get-my-property         ( TRUE | propaddr proplen FALSE )
                   14568: IF
                   14569: s" not possible"   usb-debug-print
                   14570: ELSE
                   14571: decode-int nip nip to mps-bulk-out
                   14572: THEN
                   14573: s" MPS-BULKIN" get-my-property          ( TRUE | propaddr proplen FALSE )
                   14574: IF
                   14575: s" not possible" usb-debug-print
                   14576: ELSE
                   14577: decode-int nip nip to mps-bulk-in
                   14578: THEN
                   14579: s" BULK-IN-EP-ADDR" get-my-property     ( TRUE | propaddr proplen FALSE )
                   14580: IF
                   14581: s" not possible" usb-debug-print
                   14582: ELSE
                   14583: decode-int nip nip to bulk-in-ep
                   14584: THEN
                   14585: s" BULK-OUT-EP-ADDR" get-my-property    ( TRUE | propaddr proplen FALSE )
                   14586: IF
                   14587: s" not possible"  usb-debug-print
                   14588: ELSE
                   14589: decode-int nip nip to bulk-out-ep
                   14590: THEN
                   14591: s" MPS-DCP" get-my-property             ( TRUE | propaddr proplen FALSE )
                   14592: IF
                   14593: s" Not possible" usb-debug-print
                   14594: ELSE
                   14595: decode-int nip nip to mps-dcp
                   14596: THEN
                   14597: s" LUN" get-my-property                 ( TRUE | propaddr proplen FALSE )
                   14598: IF
                   14599: s" NOT Possible to extract LUN" usb-debug-print
                   14600: ELSE
                   14601: decode-int nip nip to lun
                   14602: THEN
                   14603: s" Extracted properties inherited from parent."  usb-debug-print
1.1.1.3 ! root     14604: dma-buf >cfg-buffer 8 mps-dcp my-usb-address   ( buffer len mps fun-addr )
        !          14605: control-std-get-configuration-descriptor       ( TRUE | FALSE )
1.1       root     14606: drop
                   14607: s" Configuration descriptor extracted." usb-debug-print
1.1.1.3 ! root     14608: dma-buf >cfg-buffer 5 + c@ my-usb-address      ( configvalue fun-addr )
        !          14609: control-std-set-configuration                  ( TRUE | FALSE )
1.1       root     14610: s" usb-storage: Set config returned: " rot usb-debug-print-val
                   14611: ;
                   14612: : (open-package)  ( ihandle-var name-str name-len -- )
                   14613: find-package IF                 ( ihandle-var phandle )
                   14614: 0 0 rot open-package         ( ihandle-var ihandle )
                   14615: swap !
                   14616: ELSE
                   14617: s" Support package not found"  usb-debug-print
                   14618: THEN
                   14619: ;
                   14620: : (close-package)  ( ihandle-var -- )
                   14621: dup @ close-package
                   14622: 0 swap !
                   14623: ;
1.1.1.3 ! root     14624: s" leaving usb-storage-support.fs" usb-debug-print
        !          14625: ��������x38usb-storage-wrapper.fss" scsi" device-name
1.1       root     14626: s" block-type" device-type
                   14627: 1 encode-int s" #address-cells" property
                   14628: 0 encode-int s" #size-cells" property
                   14629: : encode-unit   1 hex-encode-unit ;
                   14630: : decode-unit   1 hex-decode-unit ;
                   14631: 1 chars alloc-mem VALUE ch-buffer
                   14632: 8 VALUE mps-dcp
                   14633: 0 VALUE port-number
                   14634: 0 VALUE my-usb-address
                   14635: : control-std-get-maxlun
                   14636: s" control-std-get-maxlun" $call-parent
                   14637: ;
                   14638: : control-std-get-configuration-descriptor
                   14639: s" control-std-get-configuration-descriptor" $call-parent
                   14640: ;
                   14641: : rw-endpoint
                   14642: s" rw-endpoint" $call-parent
                   14643: ;
                   14644: : controlxfer ( dir addr dlen setup-packet MPS ep-fun -- TRUE|FALSE )
                   14645: s" controlxfer" $call-parent
                   14646: ;
                   14647: : control-std-set-configuration
                   14648: s" control-std-set-configuration" $call-parent
                   14649: ;
                   14650: : extract-properties ( -- )
                   14651: s" USB-ADDRESS" get-inherited-property ( prop-addr prop-len FALSE | TRUE )
                   14652: IF
                   14653: s" notpossible" usb-debug-print
                   14654: ELSE
                   14655: decode-int nip nip to my-usb-address
                   14656: THEN
                   14657: s" MPS-DCP" get-inherited-property  ( prop-addr prop-len FALSE | TRUE )
                   14658: IF
                   14659: s" MPS-DCP property not found.Assume 8 as MAX PACKET SIZE" usb-debug-print
                   14660: s" for the default control pipe"  usb-debug-print
                   14661: 8 to mps-dcp
                   14662: ELSE
                   14663: s" MPS-DCP property found!!"  usb-debug-print
                   14664: decode-int nip nip to mps-dcp
                   14665: THEN
                   14666: s" reg" get-inherited-property   ( prop-addr prop-len FLASE | TRUE )
                   14667: IF
                   14668: s" notpossible" usb-debug-print
                   14669: ELSE
                   14670: decode-int nip nip to port-number
                   14671: THEN
                   14672: ;
                   14673: : create-tree ( -- )
                   14674: mps-dcp my-usb-address 0 ch-buffer 1 ( MPS fun-addr dir data-buff data-len )
                   14675: control-std-get-maxlun     ( TRUE | FALSE )
                   14676: IF
                   14677: s" GET-MAX-LUN IS WORKING :" usb-debug-print
                   14678: ELSE
                   14679: s" ERROR in GET-MAX-LUN " usb-debug-print
                   14680: THEN
                   14681: ch-buffer c@ 1 +  0                              ( max-lun+1 0 )
                   14682: DO
                   14683: s" iManufacturer" get-inherited-property drop ( prop-addr prop-len TRUE )
                   14684: decode-int nip nip                  ( iManu )
                   14685: s" iProduct" get-inherited-property drop
                   14686: decode-int nip nip                  ( iManu iProd )
                   14687: s" iSerialNumber" get-inherited-property drop
                   14688: decode-int nip nip                  ( iManu iProd iSerNum )
                   14689: s" MPS-BULKOUT" get-inherited-property drop
                   14690: decode-int nip nip                  ( iManu iProd iSerNum MPS-BULKOUT )
                   14691: s" BULK-OUT-EP-ADDR" get-inherited-property drop
                   14692: decode-int nip nip ( iManu iProd iSerNum MPS-BULKOUT BULK-OUT-EP-ADDR )
                   14693: s" MPS-BULKIN" get-inherited-property drop
                   14694: ( iManu iProd iSerNum MPS-BULKOUT BULK-OUT-EP-ADDR prop-addr prop-len
                   14695: TRUE | FALSE )
                   14696: decode-int nip nip
                   14697: s" BULK-IN-EP-ADDR" get-inherited-property drop
                   14698: ( iManu iProd iSernum MPS-BULKOUT BULK-OUT-EP-ADDR MPS-BULKIN prop-addr
                   14699: prop-len TRUE | FALSE )
                   14700: decode-int nip nip
                   14701: ( iManu iProd iSernum MPS-BULKOUT BULK-OUT-EP-ADDR MPS-BULKIN
                   14702: BULKIN-EP-ADDR )
                   14703: mps-dcp  port-number  my-usb-address I
                   14704: ( iManu iProd iSernum MPS-BULKOUT BULK-OUT-EP-ADDR MPS-BULKIN
                   14705: BULKIN-EP-ADDR mps-dcp port-address my-usb-address lun-number )
                   14706: new-device
                   14707: ( iManu iProd iSernum MPS-BULKOUT BULK-OUT-EP-ADDR MPS-BULKIN
                   14708: BULKIN-EP-ADDR mps-dcp port-address my-usb-address lun-number )
                   14709: set-space
                   14710: ( iManu iProd iSernum MPS-BULKOUT BULK-OUT-EP-ADDR MPS-BULKIN
                   14711: BULKIN-EP-ADDR mps-dcp port-number my-usb-address )
                   14712: encode-int s" USB-ADDRESS" property
                   14713: ( iManu iProd iSernum MPS-BULKOUT BULK-OUT-EP-ADDR MPS-BULKIN
                   14714: BULKIN-EP-ADDR mps-dcp port-number )
                   14715: encode-int s" reg" property
                   14716: encode-int s" MPS-DCP" property
                   14717: ( iManu iProd iSernum MPS-BULKOUT BULK-OUT-EP-ADDR MPS-BULKIN
                   14718: BULKIN-EP-ADDR )
                   14719: I encode-int s" LUN" property
                   14720: ( iManu iProd iSernum MPS-BULKOUT BULK-OUT-EP-ADDR MPS-BULKIN
                   14721: BULKIN-EP-ADDR )
                   14722: encode-int s" BULK-IN-EP-ADDR" property
                   14723: encode-int s" MPS-BULKIN" property
                   14724: encode-int s" BULK-OUT-EP-ADDR" property
                   14725: encode-int s" MPS-BULKOUT" property ( iManu iProd iSerNum )
                   14726: encode-int s" iSerialNumber" property ( iManu iProd )
                   14727: encode-int s" iProduct" property  ( iManu )
                   14728: encode-int s" iManufacturer" property ( -- )
                   14729: s" usb-storage.fs" INCLUDED
                   14730: finish-device
                   14731: LOOP
                   14732: ;
                   14733: extract-properties  \ Extract the properties from parent
                   14734: create-tree       \ this method creates the node for every lun with properties
1.1.1.3 ! root     14735: ��������.-�0usb-keyboard.fss" keyboard" device-name
1.1       root     14736: s" keyboard" device-type
                   14737: ."   USB Keyboard" cr
                   14738: 3 encode-int s" assigned-addresses" property
                   14739: 1 encode-int s" reg" property
                   14740: 1 encode-int s" configuration#" property
                   14741: s" EN" encode-string s" language" property
                   14742: 1 constant NumLk
                   14743: 2 constant CapsLk
                   14744: 4 constant ScrLk
1.1.1.3 ! root     14745: TRUE VALUE use-interrupt-transfers?
        !          14746: s" model" s" /" find-node get-property 0= IF
        !          14747: 2dup s" qemu" find-substr = TO use-interrupt-transfers?
        !          14748: drop
        !          14749: THEN
1.1       root     14750: 00 value kbd-addr
                   14751: to kbd-addr                                \ save speed bit
                   14752: 8 value mps-dcp
                   14753: 8 constant DEFAULT-CONTROL-MPS
1.1.1.3 ! root     14754: 0 value multi-key
1.1       root     14755: 0 value led-state
                   14756: 0 value temp1
                   14757: 0 value temp2
                   14758: 0 value temp3
                   14759: 0 value ret
                   14760: 0 value scancode
                   14761: 0 value kbd-shift
                   14762: 0 value kbd-scan
                   14763: 0 value key-old
                   14764: 0 value expire-ms
                   14765: 0 value mps-int-in
                   14766: 0 value int-in-ep
                   14767: 0 value int-in-toggle
1.1.1.3 ! root     14768: STRUCT
        !          14769: 80 FIELD kb>cfg              \ For config descriptors etc, size 0x80
        !          14770: 8  FIELD kb>report           \ For keyboard report, size 8
        !          14771: 8  FIELD kb>setup-packet     \ For setup-packet, size 8
        !          14772: 4  FIELD kb>data             \ Various data, size 4
        !          14773: CONSTANT /kbd-buf
        !          14774: 0 VALUE kbd-buf
        !          14775: 0 VALUE kbd-buf-dma
        !          14776: : (kbd-buf-init)  ( -- )
        !          14777: /kbd-buf s" dma-alloc" $call-parent TO kbd-buf
        !          14778: kbd-buf /kbd-buf 0 s" dma-map-in" $call-parent TO kbd-buf-dma
        !          14779: s" kbd-buf = " kbd-buf usb-debug-print-val
        !          14780: ;
        !          14781: : (kbd-buf-free)  ( -- )
        !          14782: kbd-buf kbd-buf-dma /kbd-buf s" dma-map-out" $call-parent
        !          14783: kbd-buf /kbd-buf s" dma-free" $call-parent
        !          14784: 0 TO kbd-buf
        !          14785: 0 TO kbd-buf-dma
        !          14786: ;
1.1       root     14787: s" usb-kbd-device-support.fs" included
                   14788: : control-cls-set-report ( reportvalue FuncAddr -- TRUE|FALSE )
                   14789: to temp1
                   14790: to temp2
1.1.1.3 ! root     14791: 2109000200000100 kbd-buf kb>setup-packet !
        !          14792: temp2 kbd-buf kb>data l!-le
        !          14793: 1 kbd-buf kb>data 1 kbd-buf kb>setup-packet
        !          14794: DEFAULT-CONTROL-MPS temp1 controlxfer
1.1       root     14795: ;
                   14796: : control-cls-get-report ( data-buffer data-len MPS FuncAddr -- TRUE|FALSE )
                   14797: to temp1
                   14798: to temp2
                   14799: to temp3
1.1.1.3 ! root     14800: a101000100000000 kbd-buf kb>setup-packet !
        !          14801: temp3 kbd-buf kb>setup-packet 6 + w!-le
        !          14802: 0 swap temp3 kbd-buf kb>setup-packet
        !          14803: temp2 temp1 controlxfer
1.1       root     14804: ;
1.1.1.3 ! root     14805: : int-get-report ( -- )                                     \ get report for interrupt transfer
        !          14806: 0 2 int-in-toggle kbd-buf kb>report 8 mps-int-in
        !          14807: kbd-addr int-in-ep 7 lshift or rw-endpoint               \ get report
        !          14808: swap to int-in-toggle IF
        !          14809: kbd-buf kb>report @
        !          14810: ff00000000000000 and 38 rshift to kbd-shift           \ store shift status
        !          14811: kbd-buf kb>report @
        !          14812: 0000ffffffffffff and to kbd-scan                      \ store scan codes
        !          14813: ELSE
        !          14814: 0 to kbd-shift                                        \ clear shift status
        !          14815: 0 to kbd-scan                                         \ clear scan code buffer
        !          14816: THEN
        !          14817: ;
        !          14818: : ctl-get-report ( -- )                                     \ get report for control transfer
        !          14819: kbd-buf kb>report 8 8 kbd-addr
        !          14820: control-cls-get-report IF                                \ get report
        !          14821: kbd-buf kb>report @
        !          14822: ff00000000000000 and 38 rshift to kbd-shift           \ store shift status
        !          14823: kbd-buf kb>report @
        !          14824: 0000ffffffffffff and to kbd-scan                      \ store scan codes
        !          14825: ELSE
        !          14826: 0 to kbd-shift                                        \ clear shift status
        !          14827: 0 to kbd-scan                                         \ clear scan code buffer
        !          14828: THEN
        !          14829: ;
        !          14830: : kbd-get-report  ( -- )
        !          14831: use-interrupt-transfers? IF
        !          14832: int-get-report
        !          14833: ELSE
        !          14834: ctl-get-report
        !          14835: THEN
1.1       root     14836: ;
1.1.1.3 ! root     14837: : set-led ( led -- )
        !          14838: dup to led-state
1.1       root     14839: kbd-addr control-cls-set-report drop
                   14840: ;
                   14841: : is-shift ( -- true|false )
                   14842: kbd-shift 22 and if
                   14843: true
                   14844: else
                   14845: false
                   14846: then
                   14847: ;
                   14848: : is-alt ( -- true|false )
                   14849: kbd-shift 44 and if
                   14850: true
                   14851: else
                   14852: false
                   14853: then
                   14854: ;
                   14855: : is-ctrl ( -- true|false )
                   14856: kbd-shift 11 and if
                   14857: true
                   14858: else
                   14859: false
                   14860: then
                   14861: ;
                   14862: : ctrl_alt_del_key ( char -- )
                   14863: is-ctrl if                                           \ ctrl is pressed?
                   14864: is-alt if                                        \ alt is pressed?
                   14865: 4c = if                                      \ del is pressed?
1.1.1.3 ! root     14866: s" reboot.... " usb-debug-print
1.1       root     14867: drop false                               \ invalidate del key on top of stack
                   14868: then
                   14869: false                                        \ dummy for last drop
                   14870: then
                   14871: then
1.1.1.3 ! root     14872: drop                                                 \ clear stack
1.1       root     14873: ;
                   14874: : get-ukbd-char ( ScanCode -- char|false )
1.1.1.3 ! root     14875: dup ctrl_alt_del_key                                 \ check ctrl+alt+del
1.1       root     14876: dup to scancode                                      \ store scan code
                   14877: case                                                 \ translate scan code --> char
1.1.1.3 ! root     14878: 04 of [char] a endof
        !          14879: 05 of [char] b endof
        !          14880: 06 of [char] c endof
        !          14881: 07 of [char] d endof
        !          14882: 08 of [char] e endof
        !          14883: 09 of [char] f endof
        !          14884: 0a of [char] g endof
        !          14885: 0b of [char] h endof
        !          14886: 0c of [char] i endof
        !          14887: 0d of [char] j endof
        !          14888: 0e of [char] k endof
        !          14889: 0f of [char] l endof
        !          14890: 10 of [char] m endof
        !          14891: 11 of [char] n endof
        !          14892: 12 of [char] o endof
        !          14893: 13 of [char] p endof
        !          14894: 14 of [char] q endof
        !          14895: 15 of [char] r endof
        !          14896: 16 of [char] s endof
        !          14897: 17 of [char] t endof
        !          14898: 18 of [char] u endof
        !          14899: 19 of [char] v endof
        !          14900: 1a of [char] w endof
        !          14901: 1b of [char] x endof
        !          14902: 1c of [char] y endof
        !          14903: 1d of [char] z endof
        !          14904: 1e of [char] 1 endof
        !          14905: 1f of [char] 2 endof
        !          14906: 20 of [char] 3 endof
        !          14907: 21 of [char] 4 endof
        !          14908: 22 of [char] 5 endof
        !          14909: 23 of [char] 6 endof
        !          14910: 24 of [char] 7 endof
        !          14911: 25 of [char] 8 endof
        !          14912: 26 of [char] 9 endof
        !          14913: 27 of [char] 0 endof
1.1       root     14914: 28 of 0d endof                            \ Enter
1.1.1.3 ! root     14915: 29 of 1b endof                            \ ESC
        !          14916: 2a of 08 endof                            \ Backsace
1.1       root     14917: 2b of 09 endof                            \ Tab
                   14918: 2c of 20 endof                            \ Space
1.1.1.3 ! root     14919: 2d of [char] - endof
        !          14920: 2e of [char] = endof
        !          14921: 2f of [char] [ endof
        !          14922: 30 of [char] ] endof
        !          14923: 31 of [char] \ endof
        !          14924: 33 of [char] ; endof
        !          14925: 34 of [char] ' endof
        !          14926: 35 of [char] ` endof
        !          14927: 36 of [char] , endof
        !          14928: 37 of [char] . endof
1.1       root     14929: 38 of [char] / endof
                   14930: 39 of led-state CapsLk xor set-led false endof  \ CapsLk
                   14931: 3a of 1b 7e31315b to multi-key endof      \ F1
                   14932: 3b of 1b 7e32315b to multi-key endof      \ F2
                   14933: 3c of 1b 7e33315b to multi-key endof      \ F3
                   14934: 3d of 1b 7e34315b to multi-key endof      \ F4
                   14935: 3e of 1b 7e35315b to multi-key endof      \ F5
                   14936: 3f of 1b 7e37315b to multi-key endof      \ F6
                   14937: 40 of 1b 7e38315b to multi-key endof      \ F7
                   14938: 41 of 1b 7e39315b to multi-key endof      \ F8
                   14939: 42 of 1b 7e30315b to multi-key endof      \ F9
                   14940: 43 of 1b 7e31315b to multi-key endof      \ F10
                   14941: 44 of 1b 7e33315b to multi-key endof      \ F11
                   14942: 45 of 1b 7e34315b to multi-key endof      \ F12
                   14943: 47 of led-state ScrLk xor set-led false endof   \ ScrLk
                   14944: 49 of 1b 7e315b to multi-key endof        \ Ins
                   14945: 4a of 1b 7e325b to multi-key endof        \ Home
                   14946: 4b of 1b 7e335b to multi-key endof        \ PgUp
                   14947: 4c of 1b 7e345b to multi-key endof        \ Del
                   14948: 4d of 1b 7e355b to multi-key endof        \ End
                   14949: 4e of 1b 7e365b to multi-key endof        \ PgDn
                   14950: 4f of 1b 435b to multi-key endof          \ R-arrow
                   14951: 50 of 1b 445b to multi-key endof          \ L-arrow
                   14952: 51 of 1b 425b to multi-key endof          \ D-arrow
                   14953: 52 of 1b 415b to multi-key endof          \ U-arrow
                   14954: 53 of led-state NumLk xor set-led false endof   \ NumLk
1.1.1.3 ! root     14955: 54 of [char] / endof                      \ keypad /
1.1       root     14956: 55 of [char] * endof                      \ keypad *
                   14957: 56 of [char] - endof                      \ keypad -
                   14958: 57 of [char] + endof                      \ keypad +
                   14959: 58 of 0d endof                            \ keypad Enter
1.1.1.3 ! root     14960: 89 of [char] \ endof                      \ japanese yen
1.1       root     14961: dup of false endof                        \ other keys are false
                   14962: endcase
                   14963: to ret                                        \ store char
                   14964: led-state CapsLk and 0 <> if                  \ if CapsLk is on
                   14965: scancode 03 > if                          \ from a to z ?
                   14966: scancode 1e < if
                   14967: ret 20 - to ret                   \ to Upper case
                   14968: then
                   14969: then
                   14970: then
                   14971: is-shift if                                   \ if shift is on
                   14972: scancode 03 > if                          \ from a to z ?
                   14973: scancode 1e < if
                   14974: ret 20 - to ret                   \ to Upper case
                   14975: else
                   14976: scancode
                   14977: case                              \ translate scan code --> char
                   14978: 1e of [char] ! endof
                   14979: 1f of [char] @ endof
                   14980: 20 of [char] # endof
                   14981: 21 of [char] $ endof
                   14982: 22 of [char] % endof
                   14983: 23 of [char] ^ endof
                   14984: 24 of [char] & endof
                   14985: 25 of [char] * endof
                   14986: 26 of [char] ( endof
                   14987: 27 of [char] ) endof
                   14988: 2d of [char] _ endof
                   14989: 2e of [char] + endof
                   14990: 2f of [char] { endof
                   14991: 30 of [char] } endof
                   14992: 31 of [char] | endof
                   14993: 33 of [char] : endof
                   14994: 34 of [char] " endof
                   14995: 35 of [char] ~ endof
                   14996: 36 of [char] < endof
                   14997: 37 of [char] > endof
                   14998: 38 of [char] ? endof
                   14999: dup of ret endof              \ other keys are no change
                   15000: endcase
1.1.1.3 ! root     15001: to ret                            \ overwrite new char
1.1       root     15002: then
                   15003: then
                   15004: then
                   15005: led-state NumLk and 0 <> if                   \ if NumLk is on
1.1.1.3 ! root     15006: scancode
1.1       root     15007: case                                        \ translate scan code --> char
                   15008: 59 of [char] 1 endof
                   15009: 5a of [char] 2 endof
                   15010: 5b of [char] 3 endof
                   15011: 5c of [char] 4 endof
                   15012: 5d of [char] 5 endof
                   15013: 5e of [char] 6 endof
                   15014: 5f of [char] 7 endof
                   15015: 60 of [char] 8 endof
                   15016: 61 of [char] 9 endof
                   15017: 62 of [char] 0 endof
                   15018: 63 of [char] . endof                      \ keypad .
                   15019: dup of ret endof                          \ other keys are no change
                   15020: endcase
1.1.1.3 ! root     15021: to ret                                      \ overwrite new char
1.1       root     15022: then
                   15023: ret                                           \ return char
                   15024: ;
                   15025: : key-available? ( -- true|false )
1.1.1.3 ! root     15026: multi-key 0 <> IF
1.1       root     15027: true \ multi scan code key was pressed... so key is available
                   15028: EXIT \ done
                   15029: THEN
1.1.1.3 ! root     15030: kbd-scan 0 = IF      \ if no kbd-scan code is currently available
        !          15031: kbd-get-report    \ check for new scan codes
1.1       root     15032: THEN
1.1.1.3 ! root     15033: kbd-scan 0 <>        \ if a kbd-scan is available, report true, else false
1.1       root     15034: ;
1.1.1.3 ! root     15035: : usb-kread ( -- char|false )                     \ usb key read for control transfer
        !          15036: multi-key 0 <> if                              \ if multi scan code key is pressed
        !          15037: multi-key ff and                            \ read one byte from buffer
        !          15038: multi-key 8 rshift to multi-key             \ move to next byte
        !          15039: else                                           \ normal key check
1.1       root     15040: kbd-scan 0 = IF
1.1.1.3 ! root     15041: kbd-get-report                           \ read scan-code report
1.1       root     15042: THEN
1.1.1.3 ! root     15043: kbd-scan 0 <> if                            \ scan code exist?
        !          15044: begin kbd-scan ff and dup 00 = while     \ get a last scancode in report buffer
        !          15045: kbd-scan 8 rshift to kbd-scan         \ This algorithm is wrong --> must be fixed!
        !          15046: drop                                  \ KBD doesn't set scancode in pressed order!!!
1.1       root     15047: repeat
1.1.1.3 ! root     15048: ff and dup to kbd-scan                   \ we can only digest one key at a time
        !          15049: dup key-old <> if                        \ if the scancode is new
        !          15050: dup to key-old                        \ save current scan code
        !          15051: get-ukbd-char                         \ translate scan code --> char
        !          15052: milliseconds fa + to expire-ms        \ set typematic delay 250ms
        !          15053: else                                     \ scan code is not changed
        !          15054: milliseconds expire-ms > if           \ if timer is expired ... should be considered timer carry over
        !          15055: get-ukbd-char                      \ translate scan code --> char
        !          15056: milliseconds 21 + to expire-ms     \ set typematic rate 30cps
        !          15057: else                                  \ timer is not expired
        !          15058: drop false                         \ do nothing
1.1       root     15059: then
                   15060: then
1.1.1.3 ! root     15061: kbd-scan 8 rshift to kbd-scan            \ handled scan-code
1.1       root     15062: else
1.1.1.3 ! root     15063: 0 to key-old                             \ clear privious key
        !          15064: false                                    \ no scan code --> return false
1.1       root     15065: then
                   15066: then
                   15067: ;
                   15068: : key-read ( -- char )
                   15069: 0 begin drop usb-kread dup 0 <> until                \ read key input (Interrupt transfer)
                   15070: ;
                   15071: : read ( addr len -- actual )
                   15072: 0= IF drop 0 EXIT THEN
                   15073: usb-kread ?dup  IF  swap c! 1  ELSE  0 swap c! -2  THEN
                   15074: ;
1.1.1.3 ! root     15075: (kbd-buf-init)
1.1       root     15076: kbd-init                                                 \ keyboard initialize
                   15077: milliseconds to expire-ms                                \ Timer initialize
                   15078: 0 to multi-key                                           \ multi key buffer clear
                   15079: 7 set-led                                                \ flash leds
                   15080: 250 ms
                   15081: 0 set-led
1.1.1.3 ! root     15082: (kbd-buf-free)
1.1       root     15083: s" keyboard" get-node node>path set-alias
                   15084: : open ( -- true )
1.1.1.3 ! root     15085: (kbd-buf-init)
1.1       root     15086: 7 set-led
                   15087: 100 ms
                   15088: 3 set-led
                   15089: 100 ms
                   15090: 1 set-led
                   15091: 100 ms
                   15092: usb-kread drop
                   15093: 0 set-led
                   15094: true
                   15095: ;
1.1.1.3 ! root     15096: : close
        !          15097: (kbd-buf-free)
        !          15098: ;
        !          15099: s" Keyboard init done"  usb-debug-print
        !          15100: �������� �@usb-kbd-device-support.fs: rw-endpoint
1.1       root     15101: s" rw-endpoint" $call-parent ;
                   15102: : controlxfer
                   15103: s" controlxfer" $call-parent ;
                   15104: : control-std-get-device-descriptor
                   15105: s" control-std-get-device-descriptor" $call-parent ;
                   15106: : control-std-get-configuration-descriptor
                   15107: s" control-std-get-configuration-descriptor" $call-parent ;
                   15108: : control-std-set-configuration
                   15109: s" control-std-set-configuration" $call-parent ;
                   15110: : control-cls-set-protocol ( reportvalue FuncAddr -- TRUE|FALSE )
                   15111: to temp1
                   15112: to temp2
1.1.1.3 ! root     15113: 210b000000000100 kbd-buf kb>setup-packet ! 
        !          15114: temp2 kbd-buf kb>data l!-le
        !          15115: 1 kbd-buf kb>data 1 kbd-buf kb>setup-packet
        !          15116: DEFAULT-CONTROL-MPS temp1 controlxfer  
1.1       root     15117: ;
                   15118: : control-cls-set-idle ( reportvalue FuncAddr -- TRUE|FALSE )
                   15119: to temp1
                   15120: to temp2
1.1.1.3 ! root     15121: 210a000000000000 kbd-buf kb>setup-packet ! 
        !          15122: temp2 kbd-buf kb>data l!-le
        !          15123: 0 kbd-buf kb>data 0 kbd-buf kb>setup-packet
        !          15124: DEFAULT-CONTROL-MPS temp1 controlxfer  
1.1       root     15125: ;
                   15126: : control-std-get-report-descriptor ( data-buffer data-len MPS FuncAddr -- TRUE|FALSE )
                   15127: to temp1
                   15128: to temp2
                   15129: to temp3
1.1.1.3 ! root     15130: 8106002200000000 kbd-buf kb>setup-packet ! 
        !          15131: temp3 kbd-buf kb>setup-packet 6 + w!-le
        !          15132: 0 swap temp3 kbd-buf kb>setup-packet
        !          15133: temp2 temp1 controlxfer  
1.1       root     15134: ;
                   15135: : kbd-init
                   15136: s" Starting to initialize keyboard" usb-debug-print
                   15137: s" MPS-INTIN" get-my-property
                   15138: if
                   15139: s" not possible" usb-debug-print
                   15140: else
                   15141: decode-int nip nip to mps-int-in
                   15142: then
                   15143: s" INT-IN-EP-ADDR" get-my-property
                   15144: if
                   15145: s" not possible" usb-debug-print
                   15146: else
                   15147: decode-int nip nip to int-in-ep
                   15148: then
1.1.1.3 ! root     15149: kbd-buf kb>cfg 12 8 kbd-addr           \ get device descriptor
1.1       root     15150: control-std-get-device-descriptor
                   15151: drop
1.1.1.3 ! root     15152: kbd-buf kb>cfg 9 8 kbd-addr            \ get config descriptor  
1.1       root     15153: control-std-get-configuration-descriptor
                   15154: drop
1.1.1.3 ! root     15155: kbd-buf kb>cfg 5 + c@ kbd-addr         \ set configuration  
1.1       root     15156: control-std-set-configuration
                   15157: drop
                   15158: s" KBDS: Set config returned" usb-debug-print 
                   15159: 0 kbd-addr control-cls-set-idle drop       \ set idle  
                   15160: s" KBDS: Set idle returned" usb-debug-print
1.1.1.3 ! root     15161: kbd-buf kb>cfg 3f 8 kbd-addr           \ get report descriptor
1.1       root     15162: control-std-get-report-descriptor
                   15163: drop
                   15164: s" Finished initializing keyboard" usb-debug-print 
                   15165: ;
1.1.1.3 ! root     15166: ��������&`&'0usb-mouse.fss" mouse" device-name
1.1       root     15167: s" mouse" device-type
                   15168: ."   USB Mouse" cr
                   15169: 1 encode-int s" configuration#" property
                   15170: 2 encode-int s" #buttons" property
                   15171: 4 encode-int s" assigned-addresses" property
                   15172: 2 encode-int s" reg" property
                   15173: : open true ;
                   15174: : close ;
                   15175: : get-event ( msec -- pos.x pos.y buttons true|false )
                   15176: ;
                   15177: ��������KHK       0scsi-support.fsvocabulary scsi-words                  \ create new word list named 'scsi-words'
                   15178: also scsi-words  definitions           \ place next definitions into new list
                   15179: false  value   scsi-param-debug        \ common debugging flag
                   15180: d# 0   value   scsi-param-size         \ length of CDB processed last
                   15181: h# 0   value   scsi-param-control      \ control word for CDBs as defined in SAM-4
                   15182: d# 0   value   scsi-param-errors       \ counter for detected errors
                   15183: : scsi-inc-errors
                   15184: scsi-param-errors 1 + to scsi-param-errors
                   15185: ;
                   15186: 00 CONSTANT scsi-cmd-test-unit-ready
                   15187: STRUCT
                   15188: /c     FIELD test-unit-ready>operation-code     \ 00h
                   15189: 4      FIELD test-unit-ready>reserved           \ unused
                   15190: /c     FIELD test-unit-ready>control            \ control byte as specified in SAM-4
                   15191: CONSTANT scsi-length-test-unit-ready
                   15192: : scsi-build-test-unit-ready  ( cdb -- )
                   15193: dup scsi-length-test-unit-ready erase  ( cdb )
                   15194: scsi-param-control swap test-unit-ready>control c!  ( )
                   15195: scsi-length-test-unit-ready to scsi-param-size   \ update CDB length
                   15196: ;
                   15197: 03 CONSTANT scsi-cmd-request-sense
                   15198: STRUCT
                   15199: /c     FIELD request-sense>operation-code     \ 03h
                   15200: 3      FIELD request-sense>reserved           \ unused
                   15201: /c     FIELD request-sense>allocation-length  \ buffer-length for data response
                   15202: /c     FIELD request-sense>control            \ control byte as specified in SAM-4
                   15203: CONSTANT scsi-length-request-sense
                   15204: : scsi-build-request-sense    ( alloc-len cdb -- )
                   15205: >r                         ( alloc-len )  ( R: -- cdb )
                   15206: r@ scsi-length-request-sense erase  ( alloc-len )
                   15207: scsi-cmd-request-sense r@           ( alloc-len cmd cdb )
                   15208: request-sense>operation-code c!     ( alloc-len )
                   15209: dup d# 252 >                        \ buffer length too big ?
                   15210: IF
                   15211: scsi-inc-errors
                   15212: drop d# 252                      \ replace with 252
                   15213: ELSE
                   15214: dup d# 18 <                      \ allocated buffer too small ?
                   15215: IF
                   15216: scsi-inc-errors
                   15217: drop 0                        \ reject return data
                   15218: THEN
                   15219: THEN                                      ( alloclen )
                   15220: r@ request-sense>allocation-length c!     (  )
                   15221: scsi-param-control r> request-sense>control c!  ( alloc-len cdb )  ( R: cdb -- )
                   15222: scsi-length-request-sense to scsi-param-size  \ update CDB length
                   15223: ;
                   15224: 70 CONSTANT scsi-response(request-sense-0)
                   15225: 71 CONSTANT scsi-response(request-sense-1)
                   15226: STRUCT
                   15227: /c FIELD sense-data>response-code   \ 70h (current errors) or 71h (deferred errors)
                   15228: /c FIELD sense-data>obsolete
                   15229: /c FIELD sense-data>sense-key       \ D3..D0 = sense key, D7 = EndOfMedium
                   15230: /l FIELD sense-data>info
                   15231: /c FIELD sense-data>alloc-length    \ <= 244 (for max size)
                   15232: /l FIELD sense-data>command-info
                   15233: /c FIELD sense-data>asc             \ additional sense key
                   15234: /c FIELD sense-data>ascq            \ additional sense key qualifier
                   15235: /c FIELD sense-data>unit-code
                   15236: 3  FIELD sense-data>key-specific
                   15237: /c FIELD sense-data>add-sense-bytes \ start of appended extra bytes
                   15238: CONSTANT scsi-length-sense-data
                   15239: : scsi-get-sense-data                  ( addr -- ascq asc sense-key )   
                   15240: >r                                  ( R: -- addr )
                   15241: r@ sense-data>response-code c@ 7f and 72 >= IF
                   15242: r@ 3 + c@                           ( ascq )
                   15243: r@ 2 + c@                           ( ascq asc ) 
                   15244: r> 1 + c@ 0f and                    ( ascq asc sense-key )
                   15245: ELSE
                   15246: r@ sense-data>ASCQ c@               ( ascq )
                   15247: r@ sense-data>ASC c@                ( ascq asc )
                   15248: r> sense-data>sense-key c@ 0f and   ( ascq asc sense-key ) ( R: addr -- )
                   15249: THEN
                   15250: ;
                   15251: : scsi-get-sense-data?                 ( addr -- false | ascq asc sense-key true )
                   15252: dup
                   15253: sense-data>response-code c@
                   15254: 7e AND 70 =          \ Response code (some devices have MSB set)
                   15255: IF
                   15256: scsi-get-sense-data TRUE
                   15257: ELSE
                   15258: drop FALSE        \ drop addr
                   15259: THEN
                   15260: ;
                   15261: : scsi-get-sense-ID?                 ( addr -- false | ascq asc sense-key true )
                   15262: dup
                   15263: sense-data>response-code c@
                   15264: 7e AND 70 =          \ Response code (some devices have MSB set)
                   15265: IF
                   15266: scsi-get-sense-data        ( ascq asc sense-key )
                   15267: 10 lshift                  ( ascq asc sense-key16 )
                   15268: swap 8 lshift or           ( ascq sense-key+asc )
                   15269: swap or                    \ 24-bit sense-ID ( sense-key+asc+ascq )
                   15270: TRUE
                   15271: ELSE
                   15272: drop FALSE        \ drop addr
                   15273: THEN
                   15274: ;
                   15275: 12 CONSTANT scsi-cmd-inquiry
                   15276: STRUCT
                   15277: /c     FIELD inquiry>operation-code     \ 0x12
                   15278: /c     FIELD inquiry>reserved           \ + EVPD-Bit (vital product data)
                   15279: /c     FIELD inquiry>page-code          \ page code for vital product data (if used)
                   15280: /w     FIELD inquiry>allocation-length  \ length of Data-In-Buffer
                   15281: /c     FIELD inquiry>control            \ control byte as specified in SAM-4
                   15282: CONSTANT scsi-length-inquiry
                   15283: : scsi-build-inquiry                   ( alloc-len cdb -- )
                   15284: dup scsi-length-inquiry erase       \ 6 bytes CDB
                   15285: scsi-cmd-inquiry over                             ( alloc-len cdb cmd cdb )
                   15286: inquiry>operation-code c!               ( alloc-len cdb )
                   15287: scsi-param-control over inquiry>control c! ( alloc-len cdb )
                   15288: inquiry>allocation-length w!         \ size of Data-In Buffer
                   15289: scsi-length-inquiry to scsi-param-size    \ update CDB length
                   15290: ;
                   15291: STRUCT
                   15292: /c        FIELD inquiry-data>peripheral       \ qualifier and device type
                   15293: /c        FIELD inquiry-data>reserved1
                   15294: /c        FIELD inquiry-data>version          \ supported SCSI version (1,2,3)
                   15295: /c        FIELD inquiry-data>data-format
                   15296: /c        FIELD inquiry-data>add-length       \ total block length - 4
                   15297: /c        FIELD inquiry-data>flags1
                   15298: /c        FIELD inquiry-data>flags2
                   15299: /c        FIELD inquiry-data>flags3
                   15300: d# 8   FIELD inquiry-data>vendor-ident     \ vendor string
                   15301: d# 16  FIELD inquiry-data>product-ident    \ device string
                   15302: /l     FIELD inquiry-data>product-revision \ revision string
                   15303: d# 20  FIELD inquiry-data>vendor-specific  \ optional params
                   15304: CONSTANT scsi-length-inquiry-data
                   15305: 25 CONSTANT scsi-cmd-read-capacity-10  \ command code
                   15306: STRUCT                                 \ SCSI 10-byte CDB structure
                   15307: /c     FIELD read-cap-10>operation-code
                   15308: /c     FIELD read-cap-10>reserved1
                   15309: /l     FIELD read-cap-10>lba
                   15310: /w     FIELD read-cap-10>reserved2
                   15311: /c     FIELD read-cap-10>reserved3
                   15312: /c     FIELD read-cap-10>control
                   15313: CONSTANT scsi-length-read-cap-10
                   15314: : scsi-build-read-cap-10                     ( cdb -- )
                   15315: dup scsi-length-read-cap-10 erase         ( cdb )
                   15316: scsi-cmd-read-capacity-10 over            ( cdb cmd cdb )
                   15317: read-cap-10>operation-code c!             ( cdb )
                   15318: scsi-param-control swap read-cap-10>control c! ( )
                   15319: scsi-length-read-cap-10 to scsi-param-size    \ update CDB length
                   15320: ;
                   15321: STRUCT
                   15322: /l     FIELD read-cap-10-data>max-lba
                   15323: /l     FIELD read-cap-10-data>block-size
                   15324: CONSTANT scsi-length-read-cap-10-data
                   15325: : scsi-get-capacity-10                 ( addr -- block-size #blocks )
                   15326: >r                                  ( addr -- ) ( R: -- addr )
                   15327: r@ read-cap-10-data>block-size l@   ( block-size )
                   15328: r> read-cap-10-data>max-lba l@      ( block-size #blocks ) ( R: addr -- )
                   15329: ;
                   15330: 9e CONSTANT scsi-cmd-read-capacity-16        \ command code
                   15331: STRUCT                                       \ SCSI 16-byte CDB structure
                   15332: /c     FIELD read-cap-16>operation-code
                   15333: /c     FIELD read-cap-16>service-action
                   15334: /l     FIELD read-cap-16>lba-high
                   15335: /l     FIELD read-cap-16>lba-low
                   15336: /l     FIELD read-cap-16>allocation-length    \ should be 32
                   15337: /c     FIELD read-cap-16>reserved
                   15338: /c     FIELD read-cap-16>control
                   15339: CONSTANT scsi-length-read-cap-16
                   15340: : scsi-build-read-cap-16  ( cdb -- )
                   15341: >r r@                                     ( R: -- cdb )
                   15342: scsi-length-read-cap-16 erase             (  )
                   15343: scsi-cmd-read-capacity-16                 ( code )
                   15344: r@ read-cap-16>operation-code c!          (  )
                   15345: 10 r@ read-cap-16>service-action c!
                   15346: d# 32                                     \ response size 32 bytes
                   15347: r@ read-cap-16>allocation-length l!       (  )
                   15348: scsi-param-control r> read-cap-16>control c! ( R: cdb -- )
                   15349: scsi-length-read-cap-16 to scsi-param-size \ update CDB length
                   15350: ;
                   15351: STRUCT
                   15352: /l     FIELD read-cap-16-data>max-lba-high    \ upper quadlet of Max-LBA
                   15353: /l     FIELD read-cap-16-data>max-lba-low     \ lower quadlet of Max-LBA
                   15354: /l     FIELD read-cap-16-data>block-size      \ logical block length in bytes
                   15355: /c     FIELD read-cap-16-data>protect         \ type of protection (4 bits)
                   15356: /c     FIELD read-cap-16-data>exponent        \ logical blocks per physical blocks
                   15357: /w     FIELD read-cap-16-data>lowest-aligned  \ first LBA of a phsy. block
                   15358: 10 FIELD read-cap-16-data>reserved        \ 16 reserved bytes
                   15359: CONSTANT scsi-length-read-cap-16-data        \ results in 32
                   15360: : scsi-get-capacity-16                       ( addr -- block-size #blocks )
                   15361: >r                                        ( R: -- addr )
                   15362: r@ read-cap-16-data>block-size l@         ( block-size )
                   15363: r@ read-cap-16-data>max-lba-high l@       ( block-size #blocks-high )
                   15364: d# 32 lshift                              ( block-size #blocks-upper )
                   15365: r> read-cap-16-data>max-lba-low l@ +      ( block-size #blocks ) ( R: addr -- )
                   15366: ;
                   15367: 5a CONSTANT scsi-cmd-mode-sense-10
                   15368: STRUCT
                   15369: /c     FIELD mode-sense-10>operation-code
                   15370: /c     FIELD mode-sense-10>res-llbaa-dbd-res
                   15371: /c     FIELD mode-sense-10>pc-page-code       \ page code + page control
                   15372: /c     FIELD mode-sense-10>sub-page-code
                   15373: 3      FIELD mode-sense-10>reserved2
                   15374: /w     FIELD mode-sense-10>allocation-length
                   15375: /c     FIELD mode-sense-10>control
                   15376: CONSTANT scsi-length-mode-sense-10
                   15377: : scsi-build-mode-sense-10                   ( alloc-len subpage page cdb -- )
                   15378: >r                                        ( alloc-len subpage page ) ( R: -- cdb )
                   15379: r@ scsi-length-mode-sense-10 erase        \ 10 bytes CDB
                   15380: scsi-cmd-mode-sense-10                    ( alloc-len subpage page cmd )
                   15381: r@  mode-sense-10>operation-code c!               ( alloc-len subpage page )
                   15382: 10 r@ mode-sense-10>res-llbaa-dbd-res c!  \ long LBAs accepted
                   15383: r@ mode-sense-10>pc-page-code c!                ( alloc-len subpage )
                   15384: r@ mode-sense-10>sub-page-code c!            ( alloc-len )
                   15385: r@ mode-sense-10>allocation-length w!     ( )
                   15386: scsi-param-control r> mode-sense-10>control c!  ( R: cdb -- )
                   15387: scsi-length-mode-sense-10 to scsi-param-size  \ update CDB length
                   15388: ;
                   15389: STRUCT
                   15390: /w     FIELD mode-sense-10-data>head-length
                   15391: /c     FIELD mode-sense-10-data>head-medium
                   15392: /c     FIELD mode-sense-10-data>head-param
                   15393: /c     FIELD mode-sense-10-data>head-longlba
                   15394: /c     FIELD mode-sense-10-data>head-reserved
                   15395: /w     FIELD mode-sense-10-data>head-descr-len
                   15396: CONSTANT scsi-length-mode-sense-10-data
                   15397: : .mode-sense-data   ( addr -- )
                   15398: cr
                   15399: dup mode-sense-10-data>head-length
                   15400: w@ ." Mode Length: " .d space
                   15401: dup mode-sense-10-data>head-medium
                   15402: c@ ." / Medium Type: " .d space
                   15403: dup mode-sense-10-data>head-longlba
                   15404: c@ ." / Long LBA: " .d space
                   15405: mode-sense-10-data>head-descr-len
                   15406: w@ ." / Descr. Length: " .d
                   15407: ;
                   15408: 08 CONSTANT scsi-cmd-read-6
                   15409: STRUCT
                   15410: /c FIELD read-6>operation-code      \ 08h
                   15411: /c FIELD read-6>block-address-msb   \ upper 5 bits
                   15412: /w FIELD read-6>block-address       \ lower 16 bits
                   15413: /c FIELD read-6>length              \ number of blocks to read
                   15414: /c FIELD read-6>control             \ CDB control
                   15415: CONSTANT scsi-length-read-6
                   15416: : scsi-build-read-6                    ( block# #blocks cdb -- )
                   15417: >r                                  ( block# #blocks ) ( R: -- cdb )
                   15418: r@ scsi-length-read-6 erase         \ 6 bytes CDB
                   15419: scsi-cmd-read-6 r@ read-6>operation-code c! ( block# #blocks )
                   15420: dup d# 255 >                        \ #blocks exceeded limit ?
                   15421: IF
                   15422: scsi-inc-errors
                   15423: drop 1                           \ replace with any valid number
                   15424: THEN
                   15425: r@ read-6>length c!                 \ set #blocks to read
                   15426: dup 1fffff >                        \ check address upper limit
                   15427: IF
                   15428: scsi-inc-errors
                   15429: drop                             \ remove original block#
                   15430: 1fffff                           \ replace with any valid address
                   15431: THEN
                   15432: dup d# 16 rshift
                   15433: r@ read-6>block-address-msb c!      \ set upper 5 bits
                   15434: ffff and
                   15435: r@ read-6>block-address w!                \ set lower 16 bits
                   15436: scsi-param-control r> read-6>control c!   ( R: cdb -- )
                   15437: scsi-length-read-6 to scsi-param-size     \ update CDB length
                   15438: ;
                   15439: 28 CONSTANT scsi-cmd-read-10
                   15440: STRUCT
                   15441: /c FIELD read-10>operation-code
                   15442: /c FIELD read-10>protect
                   15443: /l FIELD read-10>block-address      \ logical block address (32bits)
                   15444: /c FIELD read-10>group
                   15445: /w FIELD read-10>length             \ transfer length (16-bits)
                   15446: /c FIELD read-10>control
                   15447: CONSTANT scsi-length-read-10
                   15448: : scsi-build-read-10                         ( block# #blocks cdb -- )
                   15449: >r                                        ( block# #blocks )  ( R: -- cdb )
                   15450: r@ scsi-length-read-10 erase             \ 10 bytes CDB
                   15451: scsi-cmd-read-10 r@ read-10>operation-code c! ( block# #blocks )
                   15452: r@ read-10>length w!                      ( block# )
                   15453: r@ read-10>block-address l!               (  )
                   15454: scsi-param-control r> read-10>control c!  ( R: cdb -- )
                   15455: scsi-length-read-10 to scsi-param-size    \ update CDB length
                   15456: ;
                   15457: a8 CONSTANT scsi-cmd-read-12
                   15458: STRUCT
                   15459: /c FIELD read-12>operation-code     \ code: a8
                   15460: /c FIELD read-12>protect            \ RDPROTECT, DPO, FUA, FUA_NV
                   15461: /l FIELD read-12>block-address      \ lba
                   15462: /l FIELD read-12>length             \ transfer length (32bits)
                   15463: /c FIELD read-12>group              \ group number
                   15464: /c FIELD read-12>control
                   15465: CONSTANT scsi-length-read-12
                   15466: : scsi-build-read-12                         ( block# #blocks cdb -- )
                   15467: >r                                        ( block# #blocks )  ( R: -- cdb )
                   15468: r@ scsi-length-read-12 erase             \ 12 bytes CDB
                   15469: scsi-cmd-read-12 r@ read-12>operation-code c! ( block# #blocks )
                   15470: r@ read-12>length l!                      ( block# )
                   15471: r@ read-12>block-address l!               (  )
                   15472: scsi-param-control r> read-12>control c!  ( R: cdb -- )
                   15473: scsi-length-read-12 to scsi-param-size    \ update CDB length
                   15474: ;
                   15475: : scsi-build-read?   ( block# #blocks cdb -- length )
                   15476: over              ( block# #blocks cdb #blocks )
                   15477: fffe >            \ tx-length (#blocks) exceeds 16-bit limit ?
                   15478: IF
                   15479: scsi-build-read-12   ( block# #blocks cdb -- )
                   15480: scsi-length-read-12  ( length )
                   15481: ELSE                    ( block# #blocks cdb )
                   15482: scsi-build-read-10   ( block# #blocks cdb -- )
                   15483: scsi-length-read-10  ( length )
                   15484: THEN
                   15485: ;
                   15486: 1b CONSTANT scsi-cmd-start-stop-unit
                   15487: STRUCT
                   15488: /c FIELD start-stop-unit>operation-code
                   15489: /c FIELD start-stop-unit>immed
                   15490: /w FIELD start-stop-unit>reserved
                   15491: /c FIELD start-stop-unit>pow-condition
                   15492: /c FIELD start-stop-unit>control
                   15493: CONSTANT scsi-length-start-stop-unit
                   15494: f1 CONSTANT scsi-const-active-power    \ param used for start-stop-unit
                   15495: f2 CONSTANT scsi-const-idle-power      \ param used for start-stop-unit
                   15496: f3 CONSTANT scsi-const-standby-power   \ param used for start-stop-unit
                   15497: 3  CONSTANT scsi-const-load            \ param used for start-stop-unit
                   15498: 2  CONSTANT scsi-const-eject           \ param used for start-stop-unit
                   15499: 1  CONSTANT scsi-const-start
                   15500: 0  CONSTANT scsi-const-stop
                   15501: : scsi-build-start-stop-unit                 ( state# cdb -- )
                   15502: >r                                        ( state# )  ( R: -- cdb )
                   15503: r@ scsi-length-start-stop-unit erase      \ 6 bytes CDB
                   15504: scsi-cmd-start-stop-unit r@ start-stop-unit>operation-code c!
                   15505: dup 3 >
                   15506: IF
                   15507: 4 lshift                         \ shift to upper nibble
                   15508: THEN                                ( state )
                   15509: r@ start-stop-unit>pow-condition c!       (  )
                   15510: scsi-param-control r> start-stop-unit>control c!  ( R: cdb -- )
                   15511: scsi-length-start-stop-unit to scsi-param-size  \ update CDB length
                   15512: ;
                   15513: 2b CONSTANT scsi-cmd-seek
                   15514: STRUCT
                   15515: /c FIELD seek>operation-code
                   15516: /c FIELD seek>reserved1
                   15517: /l FIELD seek>lba
                   15518: 3  FIELD seek>reserved2
                   15519: /c FIELD seek>control
                   15520: CONSTANT scsi-length-seek
                   15521: : scsi-build-seek  ( lba cdb -- )
                   15522: >r              ( lba )  ( R: -- cdb )
                   15523: r@ scsi-length-seek erase           \ 10 bytes CDB
                   15524: scsi-cmd-seek r@ seek>operation-code c!
                   15525: r> seek>lba l!  (  )  ( R: cdb -- )
                   15526: scsi-length-seek to scsi-param-size \ update CDB length
                   15527: ;
                   15528: STRUCT
                   15529: /w FIELD media-event-data-len
                   15530: /c FIELD media-event-nea-class
                   15531: /c FIELD media-event-supp-class
                   15532: /l FIELD media-event-data
                   15533: CONSTANT scsi-length-media-event
                   15534: : scsi-build-get-media-event                     ( cdb -- )
                   15535: dup c erase                                     ( cdb )
                   15536: 4a over c!                                      ( cdb )
                   15537: 01 over 1 + c!
                   15538: 10 over 4 + c!
                   15539: 08 over 8 + c!
                   15540: drop
                   15541: ;
                   15542: : .sense-text ( scode -- )
                   15543: case
                   15544: 0    OF s" OK"               ENDOF
                   15545: 1    OF s" RECOVERED ERR"    ENDOF
                   15546: 2    OF s" NOT READY"        ENDOF
                   15547: 3    OF s" MEDIUM ERROR"     ENDOF
                   15548: 4    OF s" HARDWARE ERR"     ENDOF
                   15549: 5    OF s" ILLEGAL REQUEST"  ENDOF
                   15550: 6    OF s" UNIT ATTENTION"   ENDOF
                   15551: 7    OF s" DATA PROTECT"     ENDOF
                   15552: 8    OF s" BLANK CHECK"      ENDOF
                   15553: 9    OF s" VENDOR SPECIFIC"  ENDOF
                   15554: a    OF s" COPY ABORTED"     ENDOF
                   15555: b    OF s" ABORTED COMMAND"  ENDOF
                   15556: d    OF s" VOLUME OVERFLOW"  ENDOF
                   15557: e    OF s" MISCOMPARE"       ENDOF
                   15558: dup  OF s" UNKNOWN"          ENDOF
                   15559: endcase
                   15560: 5b emit type 5d emit
                   15561: ;
                   15562: : .status-text  ( stat -- )
                   15563: case
                   15564: 00  OF s" GOOD"                  ENDOF
                   15565: 02  OF s" CHECK CONDITION"       ENDOF
                   15566: 04  OF s" CONDITION MET"         ENDOF
                   15567: 08  OF s" BUSY"                  ENDOF
                   15568: 18  OF s" RESERVATION CONFLICT"  ENDOF
                   15569: 28  OF s" TASK SET FULL"         ENDOF
                   15570: 30  OF s" ACA ACTIVE"            ENDOF
                   15571: 40  OF s" TASK ABORTED"          ENDOF
                   15572: dup OF s" UNKNOWN"               ENDOF
                   15573: endcase
                   15574: 5b emit type 5d emit
                   15575: ;
                   15576: : .dec3-2 ( prenum postnum -- )
                   15577: swap
                   15578: base @ >r                           \ save actual base setting
                   15579: decimal                             \ show decimal values
                   15580: 4 .r 2e emit
                   15581: dup 9 <= IF 30 emit THEN .d         \ 3 pre-decimal, right aligned
                   15582: r> base !                           \ restore base
                   15583: ;
                   15584: : .capacity-text  ( block-size #blocks -- )
                   15585: scsi-param-debug                    \ debugging flag set ?
                   15586: IF                                  \ show additional info
                   15587: 2dup
                   15588: cr
                   15589: ." LBAs: " .d                    \ highest logical block number
                   15590: ." / Block-Size: " .d
                   15591: ." / Total Capacity: "
                   15592: THEN
                   15593: *                                   \ calculate total capacity
                   15594: dup d# 1000000000000 >=             \ check terabyte limit
                   15595: IF
                   15596: d# 1000000000000 /mod
                   15597: swap
                   15598: d# 10000000000 /                 \ limit remainder to two digits
                   15599: .dec3-2 ." TB"                   \ show terabytes as xxx.yy
                   15600: ELSE
                   15601: dup d# 1000000000 >=             \ check gigabyte limit
                   15602: IF
                   15603: d# 1000000000 /mod
                   15604: swap
                   15605: d# 10000000 /
                   15606: .dec3-2 ." GB"                \ show gigabytes as xxx.yy
                   15607: ELSE
                   15608: dup d# 1000000 >=
                   15609: IF
                   15610: d# 1000000 /mod            \ check mega byte limit
                   15611: swap
                   15612: d# 10000 /
                   15613: .dec3-2 ." MB"             \ show megabytes as xxx.yy
                   15614: ELSE
                   15615: dup d# 1000 >=             \ check kilo byte limit
                   15616: IF
                   15617: d# 1000 /mod
                   15618: swap
                   15619: d# 10 /
                   15620: .dec3-2 ." kB"
                   15621: ELSE
                   15622: .d ."  Bytes"
                   15623: THEN
                   15624: THEN
                   15625: THEN
                   15626: THEN
                   15627: ;
                   15628: : .inquiry-text  ( addr -- )
                   15629: 22 emit     \ enclose text with "
                   15630: dup inquiry-data>vendor-ident      8 type space
                   15631: dup inquiry-data>product-ident    10 type space
                   15632: inquiry-data>product-revision  4 type
                   15633: 22 emit
                   15634: ;
                   15635: : scsi-supp-init  ( -- )
                   15636: false   to scsi-param-debug         \ no debug strings
                   15637: h# 0   to scsi-param-size
                   15638: h# 0   to scsi-param-control        \ common CDB control byte
                   15639: d# 0   to scsi-param-errors         \ local errors (param limits)
                   15640: ;
                   15641: 0 VALUE scsi-context                   \ addr of word list on top
                   15642: : scsi-init  ( -- )
                   15643: also scsi-words                     \ append scsi word-list
                   15644: context  to scsi-context            \ save for close process
                   15645: scsi-supp-init                      \ preset all scsi-param-xxx values
                   15646: scsi-param-debug
                   15647: IF
                   15648: space ." SCSI-SUPPORT OPENED" cr
                   15649: .wordlists
                   15650: THEN
                   15651: ;
                   15652: : scsi-close  ( -- )
                   15653: scsi-param-debug
                   15654: IF
                   15655: space ." Closing SCSI-SUPPORT .. " cr
                   15656: THEN
                   15657: context scsi-context =              \ scsi word list still active ?
                   15658: IF
                   15659: scsi-param-errors 0<>          \ any errors occured ?
                   15660: IF
                   15661: cr ." ** WARNING: " scsi-param-errors .d
                   15662: ." SCSI Errors occured ** " cr
                   15663: THEN
                   15664: previous                         \ remove scsi word list on top
                   15665: 0 to scsi-context                \ prevent from being misinterpreted
                   15666: ELSE
                   15667: cr ." ** WARNING: Trying to close non-open SCSI-SUPPORT (1) ** " cr
                   15668: THEN
                   15669: scsi-param-debug
                   15670: IF
                   15671: .wordlists
                   15672: THEN
                   15673: ;
                   15674: s" scsi-init" $find drop               \ return execution pointer, when included
                   15675: previous                               \ remove scsi word list from search path
                   15676: definitions                            \ place next definitions into previous list
1.1.1.3 ! root     15677: ���������y8pci-device_1af4_1000.fss" virtio [ net ]" type cr
        !          15678: my-space pci-device-generic-setup
        !          15679: pci-io-enable
        !          15680: s" virtio-net.fs" included
        !          15681: pci-device-disable
        !          15682: ��������&`&8pci-device_1af4_1001.fss" virtio [ block ]" type cr
        !          15683: my-space pci-device-generic-setup
        !          15684: pci-master-enable
        !          15685: pci-mem-enable
        !          15686: pci-io-enable
        !          15687: s" virtio-block.fs" included
        !          15688: virtiodev 0 virtio-get-qsize virtio-vring-size
        !          15689: 1000 CLAIM VALUE queue-addr
        !          15690: queue-addr c rshift
        !          15691: virtiodev vd>base @ 8 +
        !          15692: rl!-le
        !          15693: pci-device-disable
        !          15694: ��������&`&8pci-device_1af4_1009.fss" virtio [ network ]" type cr
        !          15695: my-space pci-device-generic-setup
        !          15696: pci-master-enable
        !          15697: pci-mem-enable
        !          15698: pci-io-enable
        !          15699: s" virtio-fs.fs" included
        !          15700: virtiodev 0 virtio-get-qsize virtio-vring-size
        !          15701: 1000 CLAIM VALUE queue-addr
        !          15702: queue-addr c rshift
        !          15703: virtiodev vd>base @ 8 +
        !          15704: rl!-le
        !          15705: pci-device-disable
        !          15706: ��������&�&x0vio-hvterm.fs." Populating " pwd cr
1.1       root     15707: : open true ;
                   15708: : close ;
1.1.1.3 ! root     15709: : write ( adr len -- actual )
        !          15710: tuck
        !          15711: 0 ?DO
        !          15712: dup c@ my-unit SWAP hv-putchar
        !          15713: 1 +
        !          15714: LOOP
        !          15715: drop
        !          15716: ;
1.1       root     15717: : read  ( adr len -- actual )
                   15718: 0= IF drop 0 EXIT THEN
1.1.1.3 ! root     15719: my-unit hv-haschar 0= IF 0 swap c! -2 EXIT THEN
        !          15720: my-unit hv-getchar swap c! 1
1.1       root     15721: ;
                   15722: : setup-alias
                   15723: " hvterm" find-alias 0= IF
                   15724: " hvterm" get-node node>path set-alias
1.1.1.3 ! root     15725: ELSE
        !          15726: drop
        !          15727: THEN
1.1       root     15728: ;
                   15729: setup-alias
1.1.1.3 ! root     15730: ��������,8+�0vio-vscsi.fs." Populating " pwd
1.1       root     15731: 0 CONSTANT vscsi-debug
                   15732: 0 VALUE vscsi-unit
                   15733: : l2dma ( laddr - dma_addr)      
                   15734: ;
                   15735: 0    VALUE     crq-base
                   15736: 0    VALUE     crq-dma
                   15737: 0    VALUE     crq-offset
                   15738: 1000 CONSTANT  CRQ-SIZE
                   15739: CREATE crq 10 allot
                   15740: : crq-alloc ( -- )
                   15741: CRQ-SIZE alloc-mem to crq-base 0 to crq-offset
                   15742: crq-base l2dma to crq-dma
                   15743: ;
                   15744: : crq-free ( -- )
                   15745: vscsi-unit hv-free-crq
                   15746: crq-base CRQ-SIZE free-mem 0 to crq-base
                   15747: ;
                   15748: : crq-init ( -- res )
                   15749: crq-alloc
                   15750: vscsi-debug IF
                   15751: ." VSCSI: allocated crq at " crq-base . cr
                   15752: THEN
                   15753: crq-base CRQ-SIZE erase
                   15754: vscsi-unit crq-dma CRQ-SIZE hv-reg-crq
                   15755: dup 0 <> IF
                   15756: ." VSCSI: Error " . ."  registering CRQ !" cr
                   15757: crq-free
                   15758: THEN
                   15759: ;
                   15760: : crq-cleanup ( -- )
                   15761: crq-base 0 = IF EXIT THEN
                   15762: vscsi-debug IF
                   15763: ." VSCSI: freeing crq at " crq-base . cr
                   15764: THEN
                   15765: crq-free
                   15766: ;
                   15767: : crq-send ( msgaddr -- true | false )
                   15768: vscsi-unit swap hv-send-crq 0 =
                   15769: ;
                   15770: : crq-poll ( -- true | false)
                   15771: crq-offset crq-base + dup
                   15772: vscsi-debug IF
                   15773: ." VSCSI: crq poll " dup .
                   15774: THEN
                   15775: c@
                   15776: vscsi-debug IF
                   15777: ."  value=" dup . cr
                   15778: THEN
                   15779: 80 and 0 <> IF
                   15780: dup crq 10 move
                   15781: 0 swap c!
                   15782: crq-offset 10 + dup CRQ-SIZE >= IF drop 0 THEN to crq-offset
                   15783: true
                   15784: ELSE drop false THEN
                   15785: ;
                   15786: : crq-wait ( -- true | false)
                   15787: 0 BEGIN drop crq-poll dup not WHILE d# 1 ms REPEAT
                   15788: dup not IF
                   15789: ." VSCSI: Timeout waiting response !" cr EXIT
                   15790: ELSE
                   15791: vscsi-debug IF
                   15792: ." VSCSI: got crq: " crq dup l@ . ."  " 4 + dup l@ . ."  "
                   15793: 4 + dup l@ . ."  " 4 + l@ . cr
                   15794: THEN
                   15795: THEN
                   15796: ;
                   15797: 01 CONSTANT VIOSRP_SRP_FORMAT
                   15798: 02 CONSTANT VIOSRP_MAD_FORMAT
                   15799: 03 CONSTANT VIOSRP_OS400_FORMAT
                   15800: 04 CONSTANT VIOSRP_AIX_FORMAT
                   15801: 06 CONSTANT VIOSRP_LINUX_FORMAT
                   15802: 07 CONSTANT VIOSRP_INLINE_FORMAT
                   15803: struct
                   15804: 1 field >crq-valid
                   15805: 1 field >crq-format
                   15806: 1 field >crq-reserved
                   15807: 1 field >crq-status
                   15808: 2 field >crq-timeout
                   15809: 2 field >crq-iu-len
                   15810: 8 field >crq-iu-data-ptr
                   15811: constant /crq
                   15812: : srp-send-crq ( addr len -- )
                   15813: 80                crq >crq-valid c!
                   15814: VIOSRP_SRP_FORMAT crq >crq-format c!
                   15815: 0                 crq >crq-reserved c!
                   15816: 0                 crq >crq-status c!
                   15817: 0                 crq >crq-timeout w!
                   15818: ( len )           crq >crq-iu-len w!
                   15819: ( addr ) l2dma    crq >crq-iu-data-ptr x!
                   15820: crq crq-send
                   15821: not IF
                   15822: ." VSCSI: Error sending CRQ !" cr
                   15823: THEN
                   15824: ;
                   15825: : srp-wait-crq ( -- [tag true] | false )
                   15826: crq-wait not IF false EXIT THEN
                   15827: crq >crq-format c@ VIOSRP_SRP_FORMAT <> IF
                   15828: ." VSCSI: Unsupported SRP response: "
                   15829: crq >crq-format c@ . cr
                   15830: false EXIT
                   15831: THEN
                   15832: crq >crq-iu-data-ptr x@ true
                   15833: ;
                   15834: scsi-open
                   15835: 0 VALUE >srp_opcode
                   15836: 00 CONSTANT SRP_LOGIN_REQ
                   15837: 01 CONSTANT SRP_TSK_MGMT
                   15838: 02 CONSTANT SRP_CMD
                   15839: 03 CONSTANT SRP_I_LOGOUT
                   15840: c0 CONSTANT SRP_LOGIN_RSP
                   15841: c1 CONSTANT SRP_RSP
                   15842: c2 CONSTANT SRP_LOGIN_REJ
                   15843: 80 CONSTANT SRP_T_LOGOUT
                   15844: 81 CONSTANT SRP_CRED_REQ
                   15845: 82 CONSTANT SRP_AER_REQ
                   15846: 41 CONSTANT SRP_CRED_RSP
                   15847: 42 CONSTANT SRP_AER_RSP
                   15848: 02 CONSTANT SRP_BUF_FORMAT_DIRECT
                   15849: 04 CONSTANT SRP_BUF_FORMAT_INDIRECT
                   15850: struct
                   15851: 1 field >srp-login-opcode
                   15852: 3 +
                   15853: 8 field >srp-login-tag
                   15854: 4 field >srp-login-req-it-iu-len
                   15855: 4 +
                   15856: 2 field >srp-login-req-buf-fmt
                   15857: 1 field >srp-login-req-flags
                   15858: 5 +
                   15859: 10 field >srp-login-init-port-ids
                   15860: 10 field >srp-login-trgt-port-ids
                   15861: constant /srp-login
                   15862: struct
                   15863: 1 field >srp-lresp-opcode
                   15864: 3 +
                   15865: 4 field >srp-lresp-req-lim-delta
                   15866: 8 field >srp-lresp-tag
                   15867: 4 field >srp-lresp-max-it-iu-len
                   15868: 4 field >srp-lresp-max-ti-iu-len
                   15869: 2 field >srp-lresp-buf-fmt
                   15870: 1 field >srp-lresp-flags
                   15871: constant /srp-login-resp
                   15872: struct
                   15873: 1 field >srp-lrej-opcode
                   15874: 3 +
                   15875: 4 field >srp-lrej-reason
                   15876: 8 field >srp-lrej-tag
                   15877: 8 +
                   15878: 2 field >srp-lrej-buf-fmt
                   15879: constant /srp-login-rej
                   15880: 00 CONSTANT SRP_NO_DATA_DESC
                   15881: 01 CONSTANT SRP_DATA_DESC_DIRECT
                   15882: 02 CONSTANT SRP_DATA_DESC_INDIRECT
                   15883: struct
                   15884: 1 field >srp-cmd-opcode
                   15885: 1 field >srp-cmd-sol-not
                   15886: 3 +
                   15887: 1 field >srp-cmd-buf-fmt
                   15888: 1 field >srp-cmd-dout-desc-cnt
                   15889: 1 field >srp-cmd-din-desc-cnt
                   15890: 8 field >srp-cmd-tag
                   15891: 4 +
                   15892: 8 field >srp-cmd-lun
                   15893: 1 +
                   15894: 1 field >srp-cmd-task-attr
                   15895: 1 +
                   15896: 1 field >srp-cmd-add-cdb-len
                   15897: 10 field >srp-cmd-cdb
                   15898: 0 field >srp-cmd-cdb-add
                   15899: constant /srp-cmd
                   15900: struct
                   15901: 1 field >srp-rsp-opcode
                   15902: 1 field >srp-rsp-sol-not
                   15903: 2 +
                   15904: 4 field >srp-rsp-req-lim-delta
                   15905: 8 field >srp-rsp-tag
                   15906: 2 +
                   15907: 1 field >srp-rsp-flags
                   15908: 1 field >srp-rsp-status
                   15909: 4 field >srp-rsp-dout-res-cnt
                   15910: 4 field >srp-rsp-din-res-cnt
                   15911: 4 field >srp-rsp-sense-len
                   15912: 4 field >srp-rsp-resp-len
                   15913: 0 field >srp-rsp-data
                   15914: constant /srp-rsp
                   15915: CREATE srp 100 allot
                   15916: 0 VALUE srp-len
                   15917: : srp-prep-cmd-nodata ( id lun -- )
                   15918: srp /srp-cmd erase
                   15919: SRP_CMD srp >srp-cmd-opcode c!
                   15920: 1 srp >srp-cmd-tag x!
1.1.1.2   root     15921: srp >srp-cmd-lun 1 + c!     \ lun
                   15922: 80 or                       \ select logical unit addressing method
                   15923: srp >srp-cmd-lun c!         \ id
1.1       root     15924: /srp-cmd to srp-len   
                   15925: ;
                   15926: : srp-prep-cmd-io ( addr len id lun -- )
                   15927: srp-prep-cmd-nodata            ( addr len )
                   15928: swap l2dma                     ( len dmaaddr )
                   15929: srp srp-len +                  ( len dmaaddr descaddr )
                   15930: dup >r x! r> 8 +               ( len descaddr+8 )
                   15931: dup 0 swap l! 4 +              ( len descaddr+c )
                   15932: l!    
                   15933: srp-len 10 + to srp-len
                   15934: ;
                   15935: : srp-prep-cmd-read ( addr len id lun -- )
                   15936: srp-prep-cmd-io
                   15937: 01 srp >srp-cmd-buf-fmt c!     \ in direct buffer
                   15938: 1 srp >srp-cmd-din-desc-cnt c!
                   15939: ;
                   15940: : srp-prep-cmd-write ( addr len id lun -- )
                   15941: srp-prep-cmd-io
                   15942: 10 srp >srp-cmd-buf-fmt c!     \ out direct buffer
                   15943: 1 srp >srp-cmd-dout-desc-cnt c!
                   15944: ;
                   15945: : srp-send-cmd ( -- )
                   15946: vscsi-debug IF
                   15947: ." VSCSI: Sending SCSI cmd " srp >srp-cmd-cdb c@ . cr
                   15948: THEN
                   15949: srp srp-len srp-send-crq
                   15950: ;
                   15951: : srp-rsp-find-sense ( -- addr )
                   15952: srp >srp-rsp-data
                   15953: ;
                   15954: : srp-wait-rsp ( -- true | [ ascq asc sense-key false ] )
                   15955: srp-wait-crq not IF false EXIT THEN
                   15956: dup 1 <> IF
                   15957: ." VSCSI: Invalid CRQ response tag, want 1 got " . cr
                   15958: false EXIT
                   15959: THEN drop
                   15960: srp >srp-rsp-tag x@ dup 1 <> IF
                   15961: ." VSCSI: Invalid SRP response tag, want 1 got " . cr
                   15962: false EXIT
                   15963: THEN drop
                   15964: srp >srp-rsp-status c@
                   15965: vscsi-debug IF
                   15966: ." VSCSI: Got response status: "
                   15967: dup .status-text cr
                   15968: THEN
                   15969: 0 <> IF
                   15970: srp-rsp-find-sense
                   15971: scsi-get-sense-data
                   15972: vscsi-debug IF
                   15973: ." VSCSI: Sense key: " dup .sense-text cr         
                   15974: THEN
                   15975: false EXIT
                   15976: THEN
                   15977: true
                   15978: ;
                   15979: CREATE sector d# 512 allot
1.1.1.2   root     15980: 0 INSTANCE VALUE current-id
                   15981: 0 INSTANCE VALUE current-lun
1.1       root     15982: : test-unit-ready ( -- true | [ ascq asc sense-key false ] )
                   15983: current-id current-lun srp-prep-cmd-nodata
                   15984: srp >srp-cmd-cdb scsi-build-test-unit-ready
                   15985: srp-send-cmd
                   15986: srp-wait-rsp
                   15987: ;
                   15988: : inquiry ( -- true | false )
                   15989: sector ff current-id current-lun srp-prep-cmd-read
                   15990: ff srp >srp-cmd-cdb scsi-build-inquiry
                   15991: srp-send-cmd
                   15992: srp-wait-rsp
                   15993: dup not IF nip nip nip EXIT THEN \ swallow sense
                   15994: ;
                   15995: : read-capacity ( -- true | false )
                   15996: sector scsi-length-read-cap-10 current-id current-lun srp-prep-cmd-read
                   15997: srp >srp-cmd-cdb scsi-build-read-cap-10
                   15998: srp-send-cmd
                   15999: srp-wait-rsp
                   16000: dup not IF nip nip nip EXIT THEN \ swallow sense    
                   16001: ;
                   16002: : start-stop-unit ( state# -- true | false )
                   16003: current-id current-lun srp-prep-cmd-nodata
                   16004: srp >srp-cmd-cdb scsi-build-start-stop-unit
                   16005: srp-send-cmd
                   16006: srp-wait-rsp
                   16007: dup not IF nip nip nip EXIT THEN \ swallow sense    
                   16008: ;
                   16009: : get-media-event ( -- true | false )
                   16010: sector scsi-length-media-event current-id current-lun srp-prep-cmd-read
                   16011: srp >srp-cmd-cdb scsi-build-get-media-event
                   16012: srp-send-cmd
                   16013: srp-wait-rsp
                   16014: dup not IF nip nip nip EXIT THEN \ swallow sense    
                   16015: ;
                   16016: : read-blocks ( -- addr block# #blocks blksz -- [ #read-blocks true ] | false )
                   16017: over *                                         ( addr block# #blocks len )    
                   16018: >r rot r>                                      ( block# #blocks addr len )
                   16019: 5 0 DO
                   16020: 2dup current-id current-lun
                   16021: srp-prep-cmd-read                       ( block# #blocks addr len )
                   16022: 2swap                                  ( addr len block# #blocks )
                   16023: 2dup srp >srp-cmd-cdb scsi-build-read-10 ( addr len block# #blocks )
                   16024: 2swap                                   ( block# #blocks addr len )
                   16025: srp-send-cmd
                   16026: srp-wait-rsp
                   16027: IF 2drop nip true UNLOOP EXIT THEN
                   16028: srp >srp-rsp-status c@ 8 <> IF
                   16029: nip nip nip 2drop 2drop false EXIT
                   16030: THEN
                   16031: 3drop
                   16032: 100 ms
                   16033: LOOP
                   16034: 2drop 2drop false
                   16035: ;
                   16036: : vscsi-cleanup
                   16037: crq-cleanup
                   16038: vscsi-unit 0 rtas-set-tce-bypass
                   16039: ;
                   16040: : vscsi-init ( -- true | false )
                   16041: ." VSCSI: Initializing" cr
                   16042: " reg" get-node get-package-property IF
                   16043: ." VSCSI: Not reg property !!!" 0
                   16044: THEN
                   16045: decode-int to vscsi-unit 2drop
                   16046: vscsi-unit 1 rtas-set-tce-bypass
                   16047: crq-init 0 <> IF false EXIT THEN
                   16048: " "(C0 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00)" drop
                   16049: crq-send not IF
                   16050: ." VSCSI: Error sending init command"
                   16051: crq-cleanup false EXIT
                   16052: THEN
                   16053: crq-wait not IF
                   16054: crq-cleanup false EXIT
                   16055: THEN
                   16056: crq c@ c0 <> crq 1 + c@ 02 <> or IF
                   16057: ." VSCSI: Initial handshake failed"
                   16058: crq-cleanup false EXIT
                   16059: THEN
                   16060: ['] vscsi-cleanup add-quiesce-xt
                   16061: true
                   16062: ;
                   16063: : set-address ( lun id -- )
1.1.1.2   root     16064: to current-id to current-lun 
1.1       root     16065: ;
                   16066: : dev-max-transfer ( -- n )
                   16067: 10000 \ Larger value seem to have problems with some CDROMs
                   16068: ;
                   16069: : dev-get-capacity ( -- blocksize #blocks )
1.1.1.2   root     16070: sector 10 erase
                   16071: read-capacity not IF
                   16072: 0 0 EXIT
                   16073: THEN
1.1       root     16074: sector scsi-get-capacity-10
                   16075: ;
                   16076: : dev-read-blocks ( -- addr block# #blocks blksize -- #read-blocks )
                   16077: read-blocks    
                   16078: ;
                   16079: : initial-test-unit-ready ( -- true | [ ascq asc sense-key false ] )
                   16080: 0 0 0 false
                   16081: 3 0 DO
                   16082: 2drop 2drop
                   16083: test-unit-ready dup IF UNLOOP EXIT THEN
                   16084: LOOP    
                   16085: ;
                   16086: : compare-sense ( ascq asc key ascq2 asc2 key2 -- true | false )
                   16087: 3 pick =           ( ascq asc key ascq2 asc2 keycmp )
                   16088: swap 4 pick =   ( ascq asc key ascq2 keycmp asccmp )
                   16089: rot 5 pick =    ( ascq asc key keycmp asccmp ascqcmp )
                   16090: and and nip nip nip
                   16091: ;
                   16092: 0 CONSTANT CDROM-READY
                   16093: 1 CONSTANT CDROM-NOT-READY
                   16094: 2 CONSTANT CDROM-NO-DISK
                   16095: 3 CONSTANT CDROM-TRAY-OPEN
                   16096: 4 CONSTANT CDROM-INIT-REQUIRED
                   16097: 5 CONSTANT CDROM-TRAY-MAYBE-OPEN
                   16098: : cdrom-status ( -- status )
                   16099: initial-test-unit-ready
                   16100: IF CDROM-READY EXIT THEN
                   16101: vscsi-debug IF
                   16102: ." TestUnitReady sense: " 3dup . . . cr
                   16103: THEN
                   16104: 3dup 1 4 2 compare-sense IF
                   16105: 3drop CDROM-NOT-READY EXIT
                   16106: THEN
                   16107: get-media-event IF
                   16108: sector w@ 4 >= IF
                   16109: sector 2 + c@ 04 = IF
                   16110: sector 5 + c@
                   16111: dup 02 and 0<> IF drop 3drop CDROM-READY EXIT THEN
                   16112: dup 01 and 0<> IF drop 3drop CDROM-TRAY-OPEN EXIT THEN
                   16113: drop 3drop CDROM-NO-DISK EXIT
                   16114: THEN
                   16115: THEN
                   16116: THEN
                   16117: 3dup 2 4 2 compare-sense IF
                   16118: 3drop CDROM-INIT-REQUIRED EXIT
                   16119: THEN
                   16120: over 4 = over 2 = and IF
                   16121: 3drop CDROM-READY EXIT
                   16122: THEN
                   16123: over 3a = IF
                   16124: 3drop CDROM-NO-DISK EXIT
                   16125: THEN
                   16126: 3drop CDROM-TRAY-MAYBE-OPEN    
                   16127: ;
                   16128: : cdrom-try-close-tray ( -- )
                   16129: scsi-const-load start-stop-unit drop
                   16130: ;
                   16131: : cdrom-must-close-tray ( -- )
                   16132: scsi-const-load start-stop-unit not IF
                   16133: ." Tray open !" cr -65 throw
                   16134: THEN
                   16135: ;
                   16136: : dev-prep-cdrom ( -- )
                   16137: 5 0 DO
                   16138: cdrom-status CASE
                   16139: CDROM-READY           OF UNLOOP EXIT ENDOF
                   16140: CDROM-NO-DISK         OF ." No medium !" cr -65 THROW ENDOF
                   16141: CDROM-TRAY-OPEN       OF cdrom-must-close-tray ENDOF
                   16142: CDROM-INIT-REQUIRED   OF cdrom-try-close-tray ENDOF
                   16143: CDROM-TRAY-MAYBE-OPEN OF cdrom-try-close-tray ENDOF
                   16144: ENDCASE
                   16145: d# 1000 ms
                   16146: LOOP
                   16147: ." Drive not ready !" cr -65 THROW
                   16148: ;
                   16149: : dev-prep-disk ( -- )
1.1.1.2   root     16150: initial-test-unit-ready 0= IF
                   16151: ." Disk not ready!" cr
                   16152: 3drop
                   16153: THEN
1.1       root     16154: ;
                   16155: : vscsi-create-disk    ( lun id -- )
                   16156: " disk" 0 " vio-vscsi-device.fs" included
                   16157: ;
                   16158: : vscsi-create-cdrom   ( lun id -- )
                   16159: " cdrom" 1 " vio-vscsi-device.fs" included
                   16160: ;
                   16161: : wrapped-inquiry ( -- true | false )
                   16162: inquiry not IF false EXIT THEN
                   16163: sector inquiry-data>peripheral c@ e0 and 0 =
                   16164: ;
                   16165: 8 CONSTANT #dev
                   16166: : vscsi-find-disks      ( -- )   
                   16167: ." VSCSI: Looking for disks" cr
                   16168: #dev 0 DO                                      \ check 8 devices (no LUNs)
1.1.1.2   root     16169: 0 i set-address
1.1       root     16170: wrapped-inquiry IF     
                   16171: ."   SCSI ID " i .
                   16172: sector inquiry-data>peripheral c@ CASE
                   16173: 0   OF ." DISK     : " 0 i vscsi-create-disk  ENDOF
                   16174: 5   OF ." CD-ROM   : " 0 i vscsi-create-cdrom ENDOF
                   16175: 7   OF ." OPTICAL  : " 0 i vscsi-create-cdrom ENDOF
                   16176: e   OF ." RED-BLOCK: " 0 i vscsi-create-disk  ENDOF
                   16177: dup dup OF ." ? (" . 8 emit 29 emit 5 spaces ENDOF
                   16178: ENDCASE
                   16179: sector .inquiry-text cr
                   16180: THEN
                   16181: LOOP
                   16182: ;
                   16183: scsi-close
                   16184: : setup-alias
                   16185: " scsi" find-alias 0= IF
                   16186: " scsi" get-node node>path set-alias
1.1.1.3 ! root     16187: ELSE
        !          16188: drop
        !          16189: THEN 
1.1       root     16190: ;
                   16191: : vscsi-init-and-scan  ( -- )
1.1.1.2   root     16192: 0 0 get-node open-node ?dup 0= IF EXIT THEN
                   16193: my-self >r
                   16194: dup to my-self
1.1       root     16195: vscsi-init IF
                   16196: vscsi-find-disks
                   16197: setup-alias
                   16198: THEN
1.1.1.2   root     16199: close-node
                   16200: r> to my-self
1.1       root     16201: ;
                   16202: vscsi-init-and-scan
1.1.1.3 ! root     16203: ���������_8vio-vscsi-device.fsnew-device
1.1       root     16204: VALUE is_cdrom
                   16205: 2swap  ( $name lun id )
                   16206: 2dup set-unit encode-phys " reg" property
                   16207: 2dup device-name
                   16208: 2dup find-alias 0= IF
                   16209: get-node node>path set-alias
1.1.1.3 ! root     16210: ELSE 3drop THEN 
1.1       root     16211: s" block" device-type      
                   16212: 0 INSTANCE VALUE block-size
                   16213: 0 INSTANCE VALUE max-block-num
                   16214: 0 INSTANCE VALUE max-transfer
                   16215: : read-blocks ( addr block# #blocks -- #read )
                   16216: block-size " dev-read-blocks" $call-parent
                   16217: not IF
                   16218: ." Read blocks failed !" cr -1 throw
                   16219: THEN
                   16220: ;    
                   16221: INSTANCE VARIABLE deblocker
                   16222: : open ( -- true | false )
                   16223: my-unit " set-address" $call-parent
                   16224: is_cdrom IF " dev-prep-cdrom" ELSE " dev-prep-disk" THEN $call-parent
                   16225: " dev-max-transfer" $call-parent to max-transfer
1.1.1.2   root     16226: " dev-get-capacity" $call-parent to max-block-num to block-size
                   16227: max-block-num 0=  block-size 0= OR IF
                   16228: ." Failed to get disk capacity!" cr
                   16229: FALSE EXIT
                   16230: THEN
1.1       root     16231: 0 0 " deblocker" $open-package dup deblocker ! dup IF 
                   16232: " disk-label" find-package IF
                   16233: my-args rot interpose
                   16234: THEN
                   16235: THEN 0<>
                   16236: ;
                   16237: : close ( -- )
                   16238: deblocker @ close-package ;
                   16239: : seek ( pos.lo pos.hi -- status )
                   16240: s" seek" deblocker @ $call-method ;
                   16241: : read ( addr len -- actual )
                   16242: s" read" deblocker @ $call-method ;
                   16243: finish-device
1.1.1.3 ! root     16244: ��������@&0vio-veth.fs." Populating " pwd cr
1.1       root     16245: " network" device-type
                   16246: INSTANCE VARIABLE obp-tftp-package
                   16247: : open  ( -- okay? )
                   16248: my-unit 1 rtas-set-tce-bypass
                   16249: my-args s" obp-tftp" $open-package obp-tftp-package ! true
                   16250: ;
                   16251: : close  ( -- )
                   16252: s" close" obp-tftp-package @ $call-method
                   16253: my-unit 0 rtas-set-tce-bypass
                   16254: ;
                   16255: : load  ( addr -- len )
                   16256: s" load" obp-tftp-package @ $call-method 
                   16257: ;
                   16258: : ping  ( -- )
                   16259: s" ping" obp-tftp-package @ $call-method
                   16260: ;
                   16261: : setup-alias
                   16262: " net" find-alias 0= IF
                   16263: " net" get-node node>path set-alias
1.1.1.3 ! root     16264: ELSE
        !          16265: drop
        !          16266: THEN 
        !          16267: ;
        !          16268: setup-alias
        !          16269: ����������0virtio-net.fss" network" device-type
        !          16270: INSTANCE VARIABLE obp-tftp-package
        !          16271: /vd-len BUFFER: virtiodev
        !          16272: virtiodev virtio-setup-vd
        !          16273: : open  ( -- okay? )
        !          16274: open IF
        !          16275: my-args s" obp-tftp" $open-package obp-tftp-package !
        !          16276: true
        !          16277: ELSE
        !          16278: false
        !          16279: THEN
        !          16280: ;
        !          16281: : close  ( -- )
        !          16282: s" close" obp-tftp-package @ $call-method
        !          16283: close
        !          16284: ;
        !          16285: : load  ( addr -- len )
        !          16286: s" load" obp-tftp-package @ $call-method 
        !          16287: ;
        !          16288: : ping  ( -- )
        !          16289: s" ping" obp-tftp-package @ $call-method
        !          16290: ;
        !          16291: 6 BUFFER: local-mac
        !          16292: : setup-mac  ( -- )
        !          16293: 6 0 DO
        !          16294: virtiodev i 1 virtio-get-config
        !          16295: local-mac i + c!
        !          16296: LOOP
        !          16297: local-mac 6 encode-bytes  s" local-mac-address"  property
        !          16298: ;
        !          16299: setup-mac
        !          16300: : setup-alias  ( -- )
        !          16301: s" net" find-alias 0= IF
        !          16302: s" net" get-node node>path set-alias
        !          16303: ELSE
        !          16304: drop
        !          16305: THEN
1.1       root     16306: ;
                   16307: setup-alias
1.1.1.3 ! root     16308: ����������0virtio-block.fss" block" device-type
        !          16309: FALSE VALUE initialized?
        !          16310: 200 CONSTANT block-size
        !          16311: 8000 CONSTANT max-transfer 
        !          16312: INSTANCE VARIABLE deblocker
        !          16313: /vd-len BUFFER: virtiodev
        !          16314: virtiodev virtio-setup-vd
        !          16315: : shutdown  ( -- )
        !          16316: virtiodev virtio-blk-shutdown
        !          16317: FALSE to initialized?
        !          16318: ;
        !          16319: : init  ( -- )
        !          16320: virtiodev virtio-blk-init
        !          16321: TRUE to initialized?
        !          16322: ['] shutdown add-quiesce-xt
        !          16323: ;
        !          16324: : read-blocks  ( addr block# #blocks -- #read )
        !          16325: virtiodev virtio-blk-read
        !          16326: ;
        !          16327: : open  ( -- okay? )
        !          16328: open 0= IF false EXIT THEN
        !          16329: 0 0 s" deblocker" $open-package dup deblocker ! dup IF
        !          16330: s" disk-label" find-package IF
        !          16331: my-args rot interpose
        !          16332: THEN
        !          16333: THEN
        !          16334: dup initialized? 0= AND IF
        !          16335: init
        !          16336: THEN
        !          16337: 0<>
        !          16338: ;
        !          16339: : close  ( -- )
        !          16340: deblocker @ close-package
        !          16341: close
        !          16342: ;
        !          16343: : seek  ( pos.lo pos.hi -- status )
        !          16344: s" seek" deblocker @ $call-method
        !          16345: ;
        !          16346: : read  ( addr len -- actual )
        !          16347: s" read" deblocker @ $call-method
        !          16348: ;
        !          16349: : (set-alias)
        !          16350: s" disk" find-alias 0= IF
        !          16351: s" disk" get-node node>path set-alias
        !          16352: ELSE
        !          16353: drop
        !          16354: THEN
        !          16355: ;
        !          16356: (set-alias)
        !          16357: ��������H
        !          16358: 0virtio-fs.fs." Populating " pwd cr
        !          16359: s" network" device-type
        !          16360: 0 VALUE virtfs-rx-buffer
        !          16361: 0 VALUE virtfs-tx-buffer
        !          16362: FALSE VALUE initialized?
        !          16363: 2000 CONSTANT VIRTFS-BUF-SIZE \ 8k
        !          16364: /vd-len BUFFER: virtiodev
        !          16365: virtiodev virtio-setup-vd
        !          16366: : shutdown  ( -- )
        !          16367: initialized? 0= IF EXIT THEN
        !          16368: virtiodev virtio-fs-shutdown
        !          16369: virtfs-rx-buffer VIRTFS-BUF-SIZE free-mem
        !          16370: virtfs-tx-buffer VIRTFS-BUF-SIZE free-mem
        !          16371: FALSE to initialized?
        !          16372: ;
        !          16373: : init  ( -- success )
        !          16374: VIRTFS-BUF-SIZE alloc-mem to virtfs-rx-buffer
        !          16375: VIRTFS-BUF-SIZE alloc-mem to virtfs-tx-buffer
        !          16376: virtiodev                      ( dev )
        !          16377: virtfs-tx-buffer               ( dev tx )
        !          16378: virtfs-rx-buffer               ( reg tx rx )
        !          16379: VIRTFS-BUF-SIZE                ( reg tx rx size )   
        !          16380: virtio-fs-init         ( success )
        !          16381: dup IF
        !          16382: TRUE to initialized?
        !          16383: ['] shutdown add-quiesce-xt
        !          16384: THEN
        !          16385: ;
        !          16386: : open  ( -- okay? )
        !          16387: open 0= IF false EXIT THEN
        !          16388: initialized? 0= IF
        !          16389: init 0= IF false EXIT THEN
        !          16390: THEN   
        !          16391: true
        !          16392: ;
        !          16393: : load ( addr -- len )
        !          16394: virtiodev swap         ( dev addr )   
        !          16395: my-args                        ( dev addr str strlen )
        !          16396: 1 +            \ hack to make the following allocate 1 more byte
        !          16397: \-to-/ \ convert path elements
        !          16398: 1 - 2dup + 0 swap c! drop
        !          16399: virtio-fs-load         ( length )
        !          16400: ;
        !          16401: : close  ( -- )
        !          16402: initialized? IF
        !          16403: shutdown
        !          16404: THEN
        !          16405: close
        !          16406: ;
        !          16407: : ping ( -- )
        !          16408: cr s" ping not supported for this device" type cr cr
        !          16409: ;
        !          16410: : (set-alias)
        !          16411: " virtfs" find-alias 0= IF
        !          16412: " virtfs" get-node node>path set-alias
        !          16413: ELSE THEN 
        !          16414: ;
        !          16415: (set-alias)
        !          16416: ��������F0build_info.imgprintf t[CC]t%sn build_info.img; /opt/cross/gcc-4.4.5-nolibc/powerpc64-linux/bin/powerpc64-linux-gcc -m64
1.1       root     16417: Using built-in specs.
1.1.1.2   root     16418: Target: powerpc64-linux
                   16419: Configured with: /home/tony/buildall/src/gcc/configure --target=powerpc64-linux --enable-targets=all --prefix=/home/tony/buildall/cross.x86_64/gcc-4.4.5-nolibc/powerpc64-linux/ --enable-languages=c --with-newlib --without-headers --with-system-libunwind --disable-nls --disable-threads --disable-shared --disable-libmudflap --disable-libssp --disable-libgomp --disable-decimal-float --enable-checking=release --with-mpfr=/home/tony/buildall/src/sys-x86_64 --with-gmp=/home/tony/buildall/src/sys-x86_64 --disable-bootstrap
                   16420: Thread model: single
                   16421: gcc version 4.4.5 (GCC) 
                   16422: GNU ld (GNU Binutils) 2.20.1.20100303
1.1       root     16423:   Supported emulations:
1.1.1.2   root     16424:    elf64ppc
1.1       root     16425:    elf32ppclinux
                   16426:    elf32ppc
                   16427:    elf32ppcsim
1.1.1.3 ! root     16428: ����������Ը

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.