Index: Src/Device/IDE/IdePioBlock.asm =================================================================== --- Src/Device/IDE/IdePioBlock.asm (revision 588) +++ Src/Device/IDE/IdePioBlock.asm (working copy) @@ -76,6 +76,36 @@ rep insb ret %else ; 808x + %ifdef USE_BIRD ; insane bird rollout + push bx +.NextSector: + pushf + cli + %if 0 ;; @todo 8086+ only, anyone at all? - does not seem to work... + ; (nominal ticks / expected instruction fetch ticks / - + + ; 8088 - iAPX88 BOOK (Intel Order No. 210200-002) + %rep 256 ; 8086 - iAPX 86,88 User Manual (Intel Order No. 210201-001), TASM Quick Ref v4 + in al, dx ; 8/+4/-1+1 8/+4/-1+2 1 byte Note! 8086 will only be empty half of the time here, but too + xchg bx, ax ; 3/+1/-1+1 3/+1/-1+2 1 byte tired to calculate that now. Probably this comes out as + in al, dx ; 8/+4/-1+1 8/--/-1 1 byte a 0 or 1 cycle win in reality... + xchg bx, ax ; 3/+1/-1+1 3/+1/-1+2 1 byte + mov ah, bl ; 2/+6/-2+2 2/+2/-2+2 2 bytes + stosw ; 15/+4/-1+1 11/--/-1 1 byte + %endrep ; sum 39/+20 =59 35/+12=47 7 bytes + ; save -1/ -7 3/ -1 -3 bytes + %else + %rep 512 + in al, dx ; 8/+4/-1+1 8/+4/-1+2 1 byte + stosb ; 11/+4/-1+4 11/--/-1 1 byte + %endrep ; sum 19/+8 =26 19/+4=23 2 bytes + %endif ; x2 38/+16 =52 38/+8=46 4 bytes + popf + dec cx + jnz .NextSector + pop bx + ret + + %else ; !USE_BIRD UNROLL_SECTORS_IN_CX_TO_OWORDS ALIGN JUMP_ALIGN .ReadNextOword: @@ -85,6 +115,7 @@ %endrep loop .ReadNextOword ret + %endif ; !USE_BIRD %endif %endif ; MODULE_8BIT_IDE @@ -112,6 +143,20 @@ ret %else ; 808x + %ifdef USE_BIRD ; insane bird rollout. +.NextSector: + pushf + cli + %rep 256 ; WORDs + in ax, dx ; Read WORD + stosw ; Store WORD to [ES:DI] + %endrep + popf + dec cx + jnz .NextSector + ret + + %else ; !USE_BIRD UNROLL_SECTORS_IN_CX_TO_OWORDS ALIGN JUMP_ALIGN .ReadNextOword: @@ -121,6 +166,7 @@ %endrep loop .ReadNextOword ret + %endif ; !USE_BIRD %endif @@ -220,6 +266,37 @@ ret %else ; 808x + %ifdef USE_BIRD ; crazy bird loop unrolling + push ds + push es + pop ds + +.NextSector: + pushf + cli + %if 1 + ; 8088 - iAPX88 BOOK (Intel Order No. 210200-002) + %rep 256 ; 8086 - iAPX 86,88 User Manual (Intel Order No. 210201-001), TASM Quick Ref v4 + lodsw ; 16/+4/-1+1 12/+4|--/-1+2|+0 1 byte - Note! 8086 doesn't need instr fetch half of the time. + out dx, al ; 8/+4/-1+1 8/-- /-1 1 byte + mov al, ah ; 2/+10/-2+3 2/+6 /-2+4 2 bytes + out dx, al ; 8/--/-1 8/-- /-1 1 byte + %endrep ; sum 34/+18=52 30/+10|+6=40|36~=38 5 bytes + ; save 6/ 4 10/ 8|12~=10 -1 byte + %else + %rep 512 + lodsb ; 12/+4/-1+1 12/+4/-1+2 1 byte + out dx, al ; 8/+4/-1+1 8/--/-1 1 byte + %endrep ; sum 20/+8 =28 20/+4 =24 2 bytes + %endif ; x2 40/+16 =56 40/+8 =48 4 bytes + popf + dec cx + jnz .NextSector + + pop ds + ret + + %else ; !USE_BIRD UNROLL_SECTORS_IN_CX_TO_QWORDS push ds push es @@ -233,6 +310,7 @@ loop .WriteNextQword pop ds ret + %endif ; !USE_BIRD %endif %endif ; MODULE_8BIT_IDE @@ -259,6 +337,28 @@ ret %else ; 808x + %ifdef USE_BIRD ; crazy bird loop unrolling + push bx + push ds + push es + pop ds + +.NextSector: + pushf + cli + %rep 256 ; WORDs + lodsw ; Load WORD from [DS:SI] + out dx, ax ; Write WORD + %endrep + popf + dec cx + jnz .NextSector + + pop ds + pop bx + ret + + %else ; !USE_BIRD UNROLL_SECTORS_IN_CX_TO_QWORDS push ds push es @@ -272,6 +372,7 @@ loop .WriteNextQword pop ds ret + %endif ; !USE_BIRD %endif ;-------------------------------------------------------------------- Index: Src/Handlers/Int13h/AH9h_HInit.asm =================================================================== --- Src/Handlers/Int13h/AH9h_HInit.asm (revision 588) +++ Src/Handlers/Int13h/AH9h_HInit.asm (working copy) @@ -175,6 +175,18 @@ .SupportedBlockSizeFound: +%if 0 ; bird +;;; InitializePioMode - disable IORDY and use default mode. +%if 0 + mov dl, PIO_DEFAULT_MODE_DISABLE_IORDY +%else + mov dl, PIO_FLOW_CONTROL_MODE_xxx | 0 +%endif + mov si, FEATURE_SET_TRANSFER_MODE + call AH23h_SetControllerFeatures + STORE_ERROR_FLAG_TO_DPT FLG_INITERROR_FAILED_TO_SET_PIO_MODE + +%else ; !bird %ifdef MODULE_ADVANCED_ATA ;;; InitializePioMode ; Initialize fastest supported PIO mode @@ -190,7 +202,9 @@ mov si, FEATURE_SET_TRANSFER_MODE call AH23h_SetControllerFeatures STORE_ERROR_FLAG_TO_DPT FLG_INITERROR_FAILED_TO_SET_PIO_MODE + %endif ; MODULE_ADVANCED_ATA +%endif ; !bird %ifdef MODULE_POWER_MANAGEMENT Index: Src/Initialization/DetectDrives.asm =================================================================== --- Src/Initialization/DetectDrives.asm (revision 588) +++ Src/Initialization/DetectDrives.asm (working copy) @@ -241,4 +241,29 @@ call CreateDPT_FromAtaInformation jc SHORT DetectDrives_DriveNotFound call DriveDetectInfo_CreateForHardDisk +%ifdef USE_BIRD + call DetectPrint_DriveNameFromDrvDetectInfoInESBX + call TestBufferXfers + ret +%else ; !USE_BIRD jmp SHORT DetectPrint_DriveNameFromDrvDetectInfoInESBX +%endif ; !USE_BIRD + + +%ifdef USE_BIRD +;-------------------------------------------------------------------- +; TestBufferXfers +; Parameters: +; Returns: +; Nothing +; Corrupts registers: +;-------------------------------------------------------------------- +TestBufferXfers: + ;; @todo later. The idea is to write to the sector buffer, then read back + ;; what we just wrote and check that the data is as expected. This would + ;; help detect problems with the PIO Data Write, and in NO_ATAID_VALIDATION + ;; mode, also with PIO Data Read. Preventing the user from totally screwing + ;; up his CF card in the former case. + ret +%endif + Index: makefile =================================================================== --- makefile (revision 588) +++ makefile (working copy) @@ -40,6 +40,8 @@ # USE_386 Use instructions supported by 386 and later (defines USE_286) # # USE_AT Use features supported on AT and later systems (not available on XT) # # USE_UNDOC_INTEL Optimizations for Intel CPU:s - do NOT use on NEC V20/V30/Sony CPU:s # +# USE_BIRD Bird stuff # +# USE_BIRD_8086 Use code sequences favoring 8086+ over 8088. # # # # ** AT Builds only (when USE_AT is defined) # # *** Use this only when certain known good drives are not being detected (eg WD Caviars) # @@ -102,12 +104,13 @@ ################################################################# # Assembler preprocessor defines. # ################################################################# -DEFINES_COMMON = MODULE_STRINGS_COMPRESSED MODULE_HOTKEYS MODULE_8BIT_IDE MODULE_EBIOS MODULE_SERIAL MODULE_SERIAL_FLOPPY MODULE_POWER_MANAGEMENT RESERVE_DIAGNOSTIC_CYLINDER NO_ATAID_VALIDATION +#DEFINES_COMMON = MODULE_STRINGS_COMPRESSED MODULE_HOTKEYS MODULE_8BIT_IDE MODULE_EBIOS MODULE_SERIAL MODULE_SERIAL_FLOPPY MODULE_POWER_MANAGEMENT RESERVE_DIAGNOSTIC_CYLINDER NO_ATAID_VALIDATION +DEFINES_COMMON = MODULE_STRINGS_COMPRESSED MODULE_HOTKEYS MODULE_8BIT_IDE MODULE_EBIOS MODULE_POWER_MANAGEMENT RESERVE_DIAGNOSTIC_CYLINDER DEFINES_COMMON_LARGE = MODULE_BOOT_MENU MODULE_8BIT_IDE_ADVANCED MODULE_COMPATIBLE_TABLES -DEFINES_XT = $(DEFINES_COMMON) ELIMINATE_CGA_SNOW MODULE_8BIT_IDE_ADVANCED +DEFINES_XT = $(DEFINES_COMMON) ELIMINATE_CGA_SNOW MODULE_8BIT_IDE_ADVANCED USE_BIRD USE_BIRD_8086 DEFINES_XTPLUS = $(DEFINES_XT) USE_186 -DEFINES_AT = $(DEFINES_COMMON) USE_AT USE_286 MODULE_IRQ MODULE_ADVANCED_ATA MODULE_COMPATIBLE_TABLES +DEFINES_AT = $(DEFINES_COMMON) USE_AT USE_286 MODULE_IRQ MODULE_ADVANCED_ATA MODULE_COMPATIBLE_TABLES USE_BIRD USE_BIRD_8086 DEFINES_XT_LARGE = $(DEFINES_XT) $(DEFINES_COMMON_LARGE) DEFINES_XTPLUS_LARGE = $(DEFINES_XTPLUS) $(DEFINES_COMMON_LARGE) @@ -126,6 +129,7 @@ # Target size of the ROM, used in main.asm for number of 512B blocks and by checksum Perl script below BIOS_SIZE = 8192 # For BIOS header (use even multiplier!) +BIOS_SIZE = 12288 # For BIOS header (use even multiplier!) ROMSIZE = $(BIOS_SIZE) # Size of binary to build when building with make checksum BIOS_SIZE_LARGE = 12288 ROMSIZE_LARGE = $(BIOS_SIZE_LARGE)