cdrtools/cdrecord/README.solaris-x86-ATAPI-DMA
2025-06-15 04:19:58 +08:00

80 lines
2.9 KiB
Plaintext

A tip from From: Juergen Keil <jk@tools.de>
Solaris 9 x86 will not allow DMA for ATAPI CD/DVD-ROM drives even if
the eeprom command shows:
atapi-dma-enabled=1
Here is a patch to the file /platform/i86pc/kernel/drv/ata
that allows you to use DMA again. Note that you need to be extremely careful
when applying the patch because it may completely break your installation
if you don't do it right.
% adb /platform/i86pc/kernel/drv/ata
ata_init_drive_pcidma,10?ia
ata_init_drive_pcidma: pushl %ebp
ata_init_drive_pcidma+1: movl %esp,%ebp
ata_init_drive_pcidma+3: subl $4,%esp
ata_init_drive_pcidma+6: movl +8(%ebp),%eax
ata_init_drive_pcidma+9: cmpb $1,+0x1ad(%eax)
ata_init_drive_pcidma+0x10: jne +0x111 <ata_init_drive_pcidma+0x121>
ata_init_drive_pcidma+0x16: movl +0xc(%ebp),%eax
ata_init_drive_pcidma+0x19: movl +0x204(%eax),%eax
ata_init_drive_pcidma+0x1f: andl $1,%eax
ata_init_drive_pcidma+0x22: je +0x1a <ata_init_drive_pcidma+0x3c>
ata_init_drive_pcidma+0x24: movl +0xc(%ebp),%eax
ata_init_drive_pcidma+0x27: movzwl +4(%eax),%eax
ata_init_drive_pcidma+0x2b: sarl $8,%eax
ata_init_drive_pcidma+0x2e: andl $0x1f,%eax
ata_init_drive_pcidma+0x31: cmpl $5,%eax
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This is the check for a type 5 ATAPI device
ata_init_drive_pcidma+0x34: jne +8 <ata_init_drive_pcidma+0x3c>
ata_init_drive_pcidma+0x36:
Here's a patch that replaces the "cmpl $5" with a "cmpl $55", so
that all ATAPI devices will perform DMA transfers:
# cd /platform/i86pc/kernel/drv
# cp ata ata-orig
# echo 'ata_init_drive_pcidma+0x31?W 7555f883' | adb -w ata
Note that the exact position of the instruction that needs to be patched
may vary depending on the version of Solaris you use. Be extremely careful
when applying the patch.
IMPORTANT NOTE FOR AMD64 Systems
cd /platform/i86pc/kernel/drv/amd64
cp ata ata.orig
adb -w ata
ata_init_drive_pcidma,17?ia
0x50f0: pushq %rbp
0x50f1: xorl %edx,%edx
0x50f3: movq %rsp,%rbp
0x50f6: subq $0x20,%rsp
0x50fa: movq %rbx,-0x18(%rbp)
0x50fe: movq %r12,-0x10(%rbp)
0x5102: movq %rdi,%rbx
0x5105: movq %r13,-0x8(%rbp)
0x5109: movq $0x0,0x0(%rip)
0x5114: movq %rsi,%r12
0x5117: cmpb $0x1,0x321(%rdi)
0x511e: je +0x12 <0x5130>
0x5120: movq -0x18(%rbp),%rbx
0x5124: movq -0x10(%rbp),%r12
0x5128: movl %edx,%eax
0x512a: movq -0x8(%rbp),%r13
0x512e: leave
0x512f: ret
0x5130: testb $0x1,0x208(%rsi)
0x5137: je +0xe <0x5145>
0x5139: movzbl 0x9(%rsi),%eax
0x513d: andl $0x1f,%eax
0x5140: cmpl $0x5,%eax
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This is the check for a type 5 ATAPI device
0x5140?W7455f883 <<< This changes the code
0x5140: 0x7405f883 = 0x7455f883
?i
0x5140: cmpl $0x55,%eax