From d0a2212fb9ba7b934a58ed81c063262d1694170f Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Tue, 3 Jul 2007 08:14:15 +0000 Subject: [PATCH] sound.asm: fixed memory mapped BAR git-svn-id: svn://kolibrios.org@563 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/drivers/codec.inc | 70 +++++++++++++++++++++++++--------- kernel/trunk/drivers/sound.asm | 44 +++++++++++++-------- 2 files changed, 80 insertions(+), 34 deletions(-) diff --git a/kernel/trunk/drivers/codec.inc b/kernel/trunk/drivers/codec.inc index 860945e4f5..91324e6d1f 100644 --- a/kernel/trunk/drivers/codec.inc +++ b/kernel/trunk/drivers/codec.inc @@ -60,13 +60,15 @@ proc detect_chip stdcall, chip_tab:dword mov edi, [chip_tab] @@: mov ebx, [edi] - test ebx, ebx - jz .unknown + cmp ebx, 0xFF + je .unknown cmp eax,ebx jne .next mov eax, [edi+4] mov [codec.chip_ids], eax + mov esi, eax + call SysMsgBoardStr ret .next: add edi, 8 @@ -165,17 +167,21 @@ ac_unknown db 'unknown manufacturer',13,10,0 ac_Realtek db 'Realtek Semiconductor',13,10,0 ac_Analog db 'Analog Devices',13,10,0 ac_CMedia db 'C-Media Electronics',13,10,0 +ac_Cirrus db 'Cirrus Logic',13,10,0 + chip_unknown db 'unknown codec id ', 0 CHIP_ANALOG equ 0x41445300 CHIP_REALTEK equ 0x414C4700 CHIP_CMEDIA equ 0x434D4900 +CHIP_CIRRUS equ 0x43525900 align 16 -codecs dd CHIP_ANALOG, ac_Analog, chips_Analog +codecs dd CHIP_ANALOG, ac_Analog, chips_Analog dd CHIP_CMEDIA, ac_CMedia, chips_CMedia dd CHIP_REALTEK,ac_Realtek, chips_Realtek - dd 0 + dd CHIP_CIRRUS, ac_Cirrus, chips_Cirrus + dd 0 align 16 chips_Analog dd 0x03, chip_AD1819 @@ -187,7 +193,7 @@ chips_Analog dd 0x03, chip_AD1819 dd 0x63, chip_AD1886A dd 0x70, chip_AD1980 dd 0x75, chip_AD1985 - dd 0 + dd 0xFF chips_Realtek: dd 0x20, chip_ALC650 @@ -198,7 +204,7 @@ chips_Realtek: dd 0x80, chip_ALC658 dd 0x81, chip_ALC658D dd 0x90, chip_ALC850 - dd 0 + dd 0xFF chips_CMedia dd 0x41, chip_CM9738 dd 0x61, chip_CM9739 @@ -206,7 +212,20 @@ chips_CMedia dd 0x41, chip_CM9738 dd 0x78, chip_CM9761 dd 0x82, chip_CM9761 dd 0x83, chip_CM9761 - dd 0 + dd 0xFF + +chips_Cirrus dd 0x00, chip_CS4297 + dd 0x10, chip_CS4297A + dd 0x20, chip_CS4298 + dd 0x28, chip_CS4294 + dd 0x30, chip_CS4299 + dd 0x34, chip_CS4299D + dd 0x48, chip_CS4201 + dd 0x58, chip_CS4205 + dd 0x60, chip_CS4291 + dd 0x70, chip_CS4202 + dd 0xFF + align 16 ;Analog Devices @@ -222,18 +241,31 @@ chip_AD1980 db 'AD1980 ',0dh,0ah,00h chip_AD1985 db 'AD1985 ',0dh,0ah,00h ;Realtek -chip_ALC650 db 'ALC650 ',0dh,0ah,00h -chip_ALC650D db 'ALC650D',0dh,0ah,00h -chip_ALC650E db 'ALC650E',0dh,0ah,00h -chip_ALC650F db 'ALC650F',0dh,0ah,00h -chip_ALC655 db 'ALC655 ',0dh,0ah,00h -chip_ALC658 db 'ALC658 ',0dh,0ah,00h -chip_ALC658D db 'ALC658D',0dh,0ah,00h -chip_ALC850 db 'ALC850 ',0dh,0ah,00h +chip_ALC650 db 'ALC650 ',0dh,0ah,00h +chip_ALC650D db 'ALC650D',0dh,0ah,00h +chip_ALC650E db 'ALC650E',0dh,0ah,00h +chip_ALC650F db 'ALC650F',0dh,0ah,00h +chip_ALC655 db 'ALC655 ',0dh,0ah,00h +chip_ALC658 db 'ALC658 ',0dh,0ah,00h +chip_ALC658D db 'ALC658D',0dh,0ah,00h +chip_ALC850 db 'ALC850 ',0dh,0ah,00h ;CMedia -chip_CM9738 db 'CMI9738', 0dh,0ah,0 -chip_CM9739 db 'CMI9739', 0dh,0ah,0 -chip_CM9780 db 'CMI9780', 0dh,0ah,0 -chip_CM9761 db 'CMI9761', 0dh,0ah,0 +chip_CM9738 db 'CMI9738', 0dh,0ah,0 +chip_CM9739 db 'CMI9739', 0dh,0ah,0 +chip_CM9780 db 'CMI9780', 0dh,0ah,0 +chip_CM9761 db 'CMI9761', 0dh,0ah,0 + +;Cirrus +chip_CS4297 db 'CS4297',13,10,0 +chip_CS4297A db 'CS4297A',13,10,0 +chip_CS4298 db 'CS4298',13,10,0 +chip_CS4294 db 'CS4294',13,10,0 +chip_CS4299 db 'CS4299',13,10,0 +chip_CS4299D db 'CS4299D',13,10,0 +chip_CS4201 db 'CS4201',13,10,0 +chip_CS4205 db 'CS4205',13,10,0 +chip_CS4291 db 'CS4291',13,10,0 +chip_CS4202 db 'CS4202',13,10,0 + diff --git a/kernel/trunk/drivers/sound.asm b/kernel/trunk/drivers/sound.asm index e693ba4f0e..41a8bf817a 100644 --- a/kernel/trunk/drivers/sound.asm +++ b/kernel/trunk/drivers/sound.asm @@ -331,25 +331,24 @@ proc START stdcall, state:dword call create_primary_buff -; if REMAP_IRQ + if REMAP_IRQ -; call get_LPC_bus -; cmp eax, -1 -; jz .fail - -; mov [lpc_bus], 0 ;eax -; call remap_irq -; end if + ; call get_LPC_bus ;проверка на интелловский чипсет + ; cmp eax, -1 ;можно пропустить + ; jz .fail + mov [lpc_bus], 0 ;eax + call remap_irq + end if mov eax, VALID_IRQ mov ebx, [ctrl.int_line] mov esi, msgInvIRQ bt eax, ebx - jnc .fail + jnc .fail_msg mov eax, ATTCH_IRQ mov esi, msgAttchIRQ bt eax, ebx - jnc .fail + jnc .fail_msg stdcall AttachIntHandler, ebx, ac97_irq .reg: @@ -362,6 +361,10 @@ proc START stdcall, state:dword end if xor eax, eax ret +.fail_msg: + call SysMsgBoardStr + xor eax, eax + ret .stop: call stop xor eax, eax @@ -692,7 +695,7 @@ proc get_LPC_bus ;for Intel chipsets ONLY !!! xor eax, eax mov [bus], eax inc eax - call [PciApi] + call PciApi cmp eax, -1 je .err @@ -818,11 +821,22 @@ align 4 proc set_ICH4 stdcall AllocKernelSpace, dword 0x2000 mov edi, eax - stdcall MapPage, edi,[ctrl.codec_mem_base],PG_SW+PG_NOCACHE - mov [ctrl.codec_mem_base], edi + mov ebx, [ctrl.codec_mem_base] + and ebx, -4096 + stdcall MapPage, edi,ebx,PG_SW+PG_NOCACHE + mov ebx, [ctrl.codec_mem_base] + and ebx, 4095 + add ebx, edi + mov [ctrl.codec_mem_base], ebx add edi, 0x1000 - stdcall MapPage, edi, [ctrl.ctrl_mem_base],PG_SW+PG_NOCACHE - mov [ctrl.ctrl_mem_base], edi + + mov ebx, [ctrl.ctrl_mem_base] + and ebx, -4096 + stdcall MapPage, edi, ebx,PG_SW+PG_NOCACHE + mov ebx, [ctrl.ctrl_mem_base] + and ebx, 4095 + add ebx, edi + mov [ctrl.ctrl_mem_base], ebx mov [ctrl.codec_read16], codec_mem_r16 ;virtual mov [ctrl.codec_write16], codec_mem_w16 ;virtual