Rev 4418 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4418 | Rev 4547 | ||
---|---|---|---|
Line 154... | Line 154... | ||
154 | ; Lower 5 bits must be zero. |
154 | ; Lower 5 bits must be zero. |
155 | Overlay ehci_hardware_td ? |
155 | Overlay ehci_hardware_td ? |
156 | ; Working area for the current TD, if there is any. |
156 | ; Working area for the current TD, if there is any. |
157 | ; When TD is retired, it is written to that TD and Overlay is loaded |
157 | ; When TD is retired, it is written to that TD and Overlay is loaded |
158 | ; from the new TD, if any. |
158 | ; from the new TD, if any. |
159 | BaseList dd ? |
- | |
160 | ; Pointer to head of the corresponding pipe list. |
- | |
161 | ends |
159 | ends |
Line 162... | Line 160... | ||
162 | 160 | ||
163 | ; This structure describes the static head of every list of pipes. |
161 | ; This structure describes the static head of every list of pipes. |
164 | ; The hardware requires 32-bytes alignment of this structure. |
162 | ; The hardware requires 32-bytes alignment of this structure. |
Line 291... | Line 289... | ||
291 | dd ehci_alloc_td |
289 | dd ehci_alloc_td |
292 | dd ehci_free_td |
290 | dd ehci_free_td |
293 | dd ehci_alloc_transfer |
291 | dd ehci_alloc_transfer |
294 | dd ehci_insert_transfer |
292 | dd ehci_insert_transfer |
295 | dd ehci_new_device |
293 | dd ehci_new_device |
- | 294 | dd ehci_disable_pipe |
|
- | 295 | dd ehci_enable_pipe |
|
296 | ehci_name db 'EHCI',0 |
296 | ehci_name db 'EHCI',0 |
297 | endg |
297 | endg |
Line 298... | Line 298... | ||
298 | 298 | ||
299 | ; ============================================================================= |
299 | ; ============================================================================= |
Line 996... | Line 996... | ||
996 | .interrupt_common: |
996 | .interrupt_common: |
997 | test edx, edx |
997 | test edx, edx |
998 | jz .return0 |
998 | jz .return0 |
999 | mov word [edi+ehci_pipe.Flags-sizeof.ehci_pipe], ax |
999 | mov word [edi+ehci_pipe.Flags-sizeof.ehci_pipe], ax |
1000 | .insert: |
1000 | .insert: |
1001 | mov [edi+ehci_pipe.BaseList-sizeof.ehci_pipe], edx |
1001 | mov [edi+usb_pipe.BaseList], edx |
1002 | ; Insert to the head of the corresponding list. |
1002 | ; Insert to the head of the corresponding list. |
1003 | ; Note: inserting to the head guarantees that the list traverse in |
1003 | ; Note: inserting to the head guarantees that the list traverse in |
1004 | ; ehci_process_updated_schedule, once started, will not interact with new pipes. |
1004 | ; ehci_process_updated_schedule, once started, will not interact with new pipes. |
1005 | ; However, we still need to ensure that links in the new pipe (edi.NextVirt) |
1005 | ; However, we still need to ensure that links in the new pipe (edi.NextVirt) |
1006 | ; are initialized before links to the new pipe (edx.NextVirt). |
1006 | ; are initialized before links to the new pipe (edx.NextVirt). |
Line 1910... | Line 1910... | ||
1910 | jmp .interrupt_common |
1910 | jmp .interrupt_common |
1911 | .interrupt_fs: |
1911 | .interrupt_fs: |
1912 | call ehci_fs_interrupt_list_unlink |
1912 | call ehci_fs_interrupt_list_unlink |
1913 | .interrupt_common: |
1913 | .interrupt_common: |
1914 | @@: |
1914 | @@: |
- | 1915 | ret |
|
- | 1916 | endp |
|
- | 1917 | ||
- | 1918 | ; This procedure temporarily removes the given pipe from hardware queue. |
|
- | 1919 | ; esi -> usb_controller, ebx -> usb_pipe |
|
- | 1920 | proc ehci_disable_pipe |
|
1915 | mov edx, [ebx+usb_pipe.NextVirt] |
1921 | mov eax, [ebx+ehci_pipe.NextQH-sizeof.ehci_pipe] |
1916 | mov eax, [ebx+usb_pipe.PrevVirt] |
1922 | mov ecx, [ebx+usb_pipe.PrevVirt] |
- | 1923 | mov edx, esi |
|
- | 1924 | sub edx, ecx |
|
- | 1925 | cmp edx, sizeof.ehci_controller |
|
- | 1926 | jb .prev_is_static |
|
- | 1927 | mov [ecx+ehci_pipe.NextQH-sizeof.ehci_pipe], eax |
|
- | 1928 | ret |
|
- | 1929 | .prev_is_static: |
|
- | 1930 | mov [ecx+ehci_static_ep.NextQH-ehci_static_ep.SoftwarePart], eax |
|
- | 1931 | ret |
|
- | 1932 | endp |
|
- | 1933 | ||
- | 1934 | ; This procedure reinserts the given pipe to hardware queue |
|
- | 1935 | ; after ehci_disable_pipe, with clearing transfer queue. |
|
- | 1936 | ; esi -> usb_controller, ebx -> usb_pipe |
|
- | 1937 | ; edx -> current descriptor, eax -> new last descriptor |
|
- | 1938 | proc ehci_enable_pipe |
|
- | 1939 | ; 1. Clear transfer queue. |
|
- | 1940 | ; 1a. Clear status bits so that the controller will try to advance the queue |
|
- | 1941 | ; without doing anything, keep DataToggle and PID bits. |
|
- | 1942 | and [ebx+ehci_pipe.Overlay.Token-sizeof.ehci_pipe], 80000000h |
|
- | 1943 | ; 1b. Set [Alternate]NextTD to physical address of the new last descriptor. |
|
- | 1944 | sub eax, sizeof.ehci_gtd |
|
- | 1945 | invoke GetPhysAddr |
|
1917 | mov [edx+usb_pipe.PrevVirt], eax |
1946 | mov [ebx+ehci_pipe.HeadTD-sizeof.ehci_pipe], eax |
- | 1947 | mov [ebx+ehci_pipe.Overlay.NextTD-sizeof.ehci_pipe], eax |
|
- | 1948 | mov [ebx+ehci_pipe.Overlay.AlternateNextTD-sizeof.ehci_pipe], eax |
|
- | 1949 | ; 2. Reinsert the pipe to hardware queue. |
|
- | 1950 | lea eax, [ebx-sizeof.ehci_pipe] |
|
- | 1951 | invoke GetPhysAddr |
|
- | 1952 | inc eax |
|
- | 1953 | inc eax |
|
1918 | mov [eax+usb_pipe.NextVirt], edx |
1954 | mov ecx, [ebx+usb_pipe.PrevVirt] |
1919 | mov edx, esi |
1955 | mov edx, esi |
1920 | sub edx, eax |
1956 | sub edx, ecx |
1921 | cmp edx, sizeof.ehci_controller |
1957 | cmp edx, sizeof.ehci_controller |
1922 | mov edx, [ebx+ehci_pipe.NextQH-sizeof.ehci_pipe] |
- | |
1923 | jb .prev_is_static |
1958 | jb .prev_is_static |
- | 1959 | mov edx, [ecx+ehci_pipe.NextQH-sizeof.ehci_pipe] |
|
1924 | mov [eax+ehci_pipe.NextQH-sizeof.ehci_pipe], edx |
1960 | mov [ebx+ehci_pipe.NextQH-sizeof.ehci_pipe], edx |
- | 1961 | mov [ecx+ehci_pipe.NextQH-sizeof.ehci_pipe], eax |
|
1925 | ret |
1962 | ret |
1926 | .prev_is_static: |
1963 | .prev_is_static: |
- | 1964 | mov edx, [ecx+ehci_static_ep.NextQH-ehci_static_ep.SoftwarePart] |
|
- | 1965 | mov [ebx+ehci_pipe.NextQH-sizeof.ehci_pipe], edx |
|
1927 | mov [eax+ehci_static_ep.NextQH-ehci_static_ep.SoftwarePart], edx |
1966 | mov [ecx+ehci_static_ep.NextQH-ehci_static_ep.SoftwarePart], eax |
1928 | ret |
1967 | ret |
1929 | endp |
1968 | endp |
Line 1930... | Line 1969... | ||
1930 | 1969 | ||
1931 | proc ehci_alloc_td |
1970 | proc ehci_alloc_td |