kernel/ahci: support CD/DVD drives (ATAPI) #694
Dismiss Review
Are you sure you want to dismiss this review?
Labels
Clear labels
Influence/Text/TYPO
AI
Eolite
FS
GSoC
Good First PR
HLL
HardwareTested
IRCC
Influence/Settings
Lang/C
Lang/FASM
Pay for the code
Subsystem/API
Subsystem/Audio
Subsystem/Graphics
Subsystem/IPC and events
Subsystem/Memory
Subsystem/Network
Subsystem/Services(daemon)
Subsystem/Taskmanager
Subsystem/VFS
Subsystem/Window
This issue or PR in the Google Source of Code program
The issue is suitable to beginners
Paid task
infinity service, audio drivers, midi, speacker, audio programs
vesa, vga, framebuffer, cursors, blitter, and video drivers
pipes, signals, events, shared memory
virt and phys memory allocators, malloc and other
userspace and kernel(for example: serial) services
process, threads, run apps, scheduler
drivers from filesystem, fs api, blkdev, programs that work with the file system
windows, skins, buttons, mouse and keyboard code for windows (not the base code)
Category
Applications
Category
Drivers
Category
General
Category
Kernel
Category
Libraries
Kind
Breaking
Breaking change that won't be backward compatible
Kind
Bug
Something is not working
Kind
Build
Kind
Documentation
Documentation changes
Kind
Enhancement
Improve existing functionality
Kind
Feature
New functionality
Kind
Security
This is security issue
Kind
Testing
Issue or pull request related to testing
PR
Ready to merge
Pull request is ready for merge
PR
Conflicts
PR conflicts with main
PR
Dependent
This PR is dependent on another PR
PR
Request changes
Changes requested in pull request
PR
Review required
Priority
Critical
1
The priority is critical
Priority
High
2
The priority is high
Priority
Medium
3
The priority is medium
Priority
Low
4
The priority is low
Reviewed
Confirmed
Issue has been confirmed
Reviewed
Duplicate
This issue or pull request already exists
Reviewed
Invalid
Invalid issue
Reviewed
Won't Fix
This issue won't be fixed
Status
Abandoned
Somebody has started to work on this but abandoned work
Status
Blocked
Something is blocking this issue or pull request
Status
Need More Info
Feedback is required to reproduce issue or to continue work
No labels
Milestone
No items
No Milestone
Projects
Clear projects
No projects
No Assignees
Notifications
Due Date
No due date set.
Depends on
#695 kernel/disk: release the partition scan buffer with kernel_free
KolibriOS/kolibrios
Reference: KolibriOS/kolibrios#694
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary: an optical drive on an AHCI port was detected and then ignored,
so CD/DVD only worked with the controller switched to IDE mode. It now
shows up as /srN and ISO9660 discs are readable, including disc changes.
Details:
(A bit in the command header, CDB in acmd, DMA when IDENTIFY PACKET
word 49 allows it, DMADIR when word 62 requires it). Built on top of it:
TEST UNIT READY, REQUEST SENSE, READ CAPACITY(10), READ(10), READ TOC
(start of the last session for multisession discs) and START STOP UNIT
for DISKFUNC.LoadTray.
2048-byte sectors and read-only media; iso9660 mounts them as /srN/1.
They cannot be named cd*: fs_lfn.inc sends every path starting with "cd"
to the old ATAPI-over-IDE code.
fails, so after a UNIT ATTENTION querymedia fails once and the kernel
immediately mounts the new disc. A READ(10) that hits UNIT ATTENTION
fails instead of silently reading the new disc.
the PRDT always covers the whole request. The PRDT builder moved out of
ahci_rw_sectors into ahci_build_prdt and is shared by both paths.
READY) restarts the port quietly instead of running the full recovery.
controller to polling: missing interrupts are counted per port and only
that port's PxIE is turned off.
during init) is now behind AHCI_DBGLVL, off by default. Errors and one
line per detected device are still printed.
Tested: QEMU, VirtualBox and VMware (detection, listings and reads checked
against host checksums; eject/insert in QEMU and VirtualBox, a direct disc
swap in VirtualBox, an empty drive in VMware), SATA disk read/write on the
same controller in QEMU, and a GA-D525TUD (NM10) with an ASUS DRW-24B3ST:
detection, reading, disc change. The debug level change was build-tested
only.
Assisted-by: Claude Opus 5
9a651cffcfto50770e2459Three small things, none of them blocking.
1.
tmp_bufleaks whendisk_addfails.ahci_atapi_parse_identifyallocates the 4 KiB scratch page intoPORT_DATA.tmp_bufduring identify, but the.disk_add_failpath inahci_initreturns without freeing it. One page, once, at boot, and only under memory pressure - but it is the only allocation in the new code without a counterpart.2.
ahci_atapi_closemediadoes not take the port mutex. The other three callbacks (read,querymedia,loadtray) all do. It is safe as things stand, since the kernel only closes a medium when nobody holds it, but the odd one out invites the question every time someone reads the file. Two lines to make it uniform.3. Stray blank line - there are two before
jmp .after_add_diskat the end of.add_optical_drive.ec71bd204dtob56f9a967fb56f9a967ftodf611c3d9b