Subversion Repositories Kolibri OS

Rev

Rev 9136 | Rev 9139 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9136 Rev 9138
Line 656... Line 656...
656
        mov     ecx, ((46-27)+1)*2
656
        mov     ecx, ((46-27)+1)*2
657
        cld
657
        cld
658
        rep movsb
658
        rep movsb
659
        mov     byte [edi], 0
659
        mov     byte [edi], 0
Line 660... Line -...
660
        
-
 
661
        xor     ecx, ecx
-
 
662
.reverse1:
-
 
663
        cmp     ecx, ((46-27)+1)*2
-
 
664
        jae     .reverse1_end
-
 
665
        mov     bl, byte [modelstr + ecx]
660
        
666
        mov     dl, byte [modelstr + ecx + 1]
-
 
667
        mov     byte [modelstr + ecx], dl
-
 
668
        mov     byte [modelstr + ecx + 1], bl
-
 
669
        add     ecx, 2
-
 
670
        jmp     .reverse1
-
 
671
.reverse1_end:
661
        stdcall swap_bytes_in_words, modelstr, (46-27)+1
Line -... Line 662...
-
 
662
        DEBUGF  1, "IDENTIFICATION RESULT: MODEL = %s\n", modelstr
-
 
663
 
-
 
664
        mov     esi, [buf_virt]
-
 
665
        mov     eax, [esi + 200]
-
 
666
        mov     edx, [esi + 200 + 4]
-
 
667
        DEBUGF 1, "lba48 mode sector count = 0x%x:%x\n", edx, eax
-
 
668
 
-
 
669
        shrd    eax, edx, 11 ; i.e *512 / 1024 / 1024, 512 - sector size
-
 
670
        DEBUGF  1, "disk capacity = %u MiB ", eax
672
        DEBUGF  1, "IDENTIFICATION RESULT: MODEL = %s\n", modelstr
671
        shrd    eax, edx, 10 ; / 1024
673
 
672
        DEBUGF  1, "= %u GiB\n", eax
674
.ret:
673
.ret:
675
        popad
674
        popad
Line 725... Line 724...
725
        call    ahci_flush_cmd
724
        call    ahci_flush_cmd
726
        pop     ecx
725
        pop     ecx
727
        ret
726
        ret
Line 728... Line 727...
728
 
727
 
729
; ---------------------------------------------------------------------------
-
 
730
; TODO: check correctness
728
; ---------------------------------------------------------------------------
731
; in: port - address of HBA_PORT structure
729
; in: port - address of HBA_PORT structure
732
;     portno - port index (0..31)
730
;     portno - port index (0..31)
733
;     pdata - address of PORT_DATA structure
731
;     pdata - address of PORT_DATA structure
734
proc ahci_port_rebase stdcall, port: dword, portno: dword, pdata: dword
732
proc ahci_port_rebase stdcall, port: dword, portno: dword, pdata: dword
Line 883... Line 881...
883
        mov     ecx, dword [cnt]
881
        mov     ecx, dword [cnt]
884
        rep stosb   
882
        rep stosb   
885
        pop     edi ecx eax
883
        pop     edi ecx eax
886
        ret 
884
        ret 
887
endp
885
endp
-
 
886
 
-
 
887
; Swaps byte order in words
-
 
888
; base - address of first word
-
 
889
; len - how many words to swap bytes in
-
 
890
; doesnt clobber any registers
-
 
891
proc swap_bytes_in_words stdcall, base: dword, len: dword
-
 
892
        push    eax ebx ecx
-
 
893
        xor     ecx, ecx
-
 
894
        mov     ebx, [base]
-
 
895
.loop:
-
 
896
        cmp     ecx, [len]
-
 
897
        jae     .loop_end
-
 
898
        mov     ax, word [ebx + ecx*2]
-
 
899
        xchg    ah, al
-
 
900
        mov     word [ebx + ecx*2], ax
-
 
901
        inc     ecx
-
 
902
        jmp     .loop
-
 
903
.loop_end:
-
 
904
        pop     ecx ebx eax
-
 
905
        ret
-
 
906
endp