View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000098 | Kolibri OS (trunk) | Kernel | public | 2015-06-16 20:32 | 2017-01-22 23:53 |
Reporter | Cameron | Assigned To | dunkaist | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | Any x86 / Любой x86 | OS | KolibriOS | OS Version | SVN autobuilds |
Product Version | SVN build / автосборка SVN | ||||
Fixed in Version | SVN build / автосборка SVN | ||||
Summary | 0000098: File system error on FAT16 formatted hard disk (qemu) | ||||
Description | Attached hard disks that were formatted by MS-DOS cannot be accessed by KolibriOS in Qemu. | ||||
Steps To Reproduce | Here is a detailed description of the exact steps I performed. 1.) Download the latest KolibriOS from http://builds.kolibrios.org/eng/latest-distr.7z and extract all the files into a directory called KolibriOS. 2.) Download the latest Qemu build for Windows and place it in a subdirectory of KolibriOS called qemu. 3.) Open a command-line and CD into the KolibriOS directory. 4.) Create a 512 MB hard disk image with the following command: qemu\qemu-img.exe create -f raw harddisk.img 512M 5.) Download a MS-DOS 6.22 boot disk from here http://www.allbootdisks.com/download/dos.html and place it in the KolibriOS directory. 6.) Start up the DOS boot disk, which will be used to format the hard disk image. qemu\qemu-system-i386.exe -fda Dos6.22.img -hda harddisk.img -boot a 7.) Once DOS has booted up, run 'fdisk', choose "Create DOS Partition or Logical DOS drive", "Create Primary DOS Partition", choose "Y" to use the maximum size, and it should create a partition. Press a key to reboot the VM. After it has rebooted, run 'format c:' to create a FAT16 filesystem. Run 'echo Hello > C:\foo.txt' to create a simple test file on the new partition. Close the VM. 8.) Boot up KolibriOS using the following command: qemu\qemu-system-i386.exe -fda kolibri.img -hda harddisk.img -boot a 9.) The hard disk image should be mapped to /hd0/1, however KFM gives a "File system error" instead of showing the actual contents. Trying to cd into /hd0/1 from the shell also throws an error. | ||||
Additional Information | Issue also happens with a floppy image. I cannot access /fd2/1 Also happens when booting the live CD (kolibri.iso). I am sure the created disk images are valid since I am able to access them from both Windows XP and Lubuntu in a Qemu VM, but trying to access them from KolibriOS gives an error. | ||||
Tags | floppy, pci, qemu | ||||
SVN revision / ревизия SVN | |||||
Type of distribution / Тип дистрибутива | any / любой | ||||
|
qemu_pci_bus_master.diff (2,493 bytes)
Index: detect/init_ata.inc =================================================================== --- detect/init_ata.inc (revision 6812) +++ detect/init_ata.inc (working copy) @@ -31,6 +31,7 @@ mov eax, [esi+PCIDEV.class] DEBUGF 1, 'K : IDE controller programming interface %x\n', eax mov [ecx+IDE_DATA.ProgrammingInterface], eax + mov [ecx+IDE_DATA.pcidev], esi mov ah, [esi+PCIDEV.bus] mov al, 2 @@ -137,6 +138,31 @@ IDE_device_3 rd 2 ;-------------------------------------- endg + +;-------------------------------------- +; set Bus Master bit of Command PCI register +;-------------------------------------- +set_pci_command_bus_master: +PCI_COMMAND_BUS_MASTER = 0x0004 + push eax ecx + + mov ecx, [ecx+IDE_DATA.pcidev] + mov ah, [ecx+PCIDEV.bus] + mov al, 1 ; word + mov bh, [ecx+PCIDEV.devfn] + mov bl, 0x4 ; Command register + push eax + call pci_read_reg + mov ecx, eax + pop eax + test ecx, PCI_COMMAND_BUS_MASTER ; already set? + jnz @f + or ecx, PCI_COMMAND_BUS_MASTER + call pci_write_reg +@@: + pop ecx eax + ret + ;----------------------------------------------------------------------------- ; START of initialisation IDE ATA code ;----------------------------------------------------------------------------- @@ -302,6 +328,7 @@ mov dx, [ecx+IDE_DATA.BAR1_val] ;0x3F4 add dx, 2 ;0x3F6 out dx, al + call set_pci_command_bus_master DEBUGF 1, "K : IDE CH1 DMA enabled\n" mov [ecx+IDE_DATA.dma_hdd_channel_1], byte 1 ;-------------------------------------- @@ -356,6 +383,7 @@ mov dx, [ecx+IDE_DATA.BAR3_val] ;0x374 add dx, 2 ;0x376 out dx, al + call set_pci_command_bus_master DEBUGF 1, "K : IDE CH2 DMA enabled\n" mov [ecx+IDE_DATA.dma_hdd_channel_2], byte 1 ;-------------------------------------- Index: const.inc =================================================================== --- const.inc (revision 6812) +++ const.inc (working copy) @@ -747,6 +747,7 @@ BAR3_val dw ? dma_hdd_channel_1 db ? dma_hdd_channel_2 db ? + pcidev dd ? ; pointer to corresponding PCIDEV structure ends struct IDE_CACHE |
|
The issue with IDE disks is that - Active bit in Bus_Master_ATA_Status register is set; - however Bus_Master bit in Command PCI register is not set. Qemu honors PCI_COMMAND_MASTER starting with 1c380f946052. I attached a patch that sets Bus_Master bit when a device enables DMA. However, I never touched this part of kernel and ask somebody to review it. The issue with floppy stays open. |
|
fd_fd2.diff (1,016 bytes)
Index: blkdev/flp_drv.inc =================================================================== --- blkdev/flp_drv.inc (revision 6813) +++ blkdev/flp_drv.inc (revision 6814) @@ -368,7 +368,8 @@ ; Подать команду "Рекалибровка" mov AL, 07h call FDCDataOutput - mov AL, 00h + mov AL, [flp_number] + dec AL call FDCDataOutput ; Ожидать завершения операции call WaitFDCInterrupt @@ -484,6 +485,8 @@ call FDCDataOutput mov AL, [FDD_Head] shl AL, 2 + or AL, [flp_number] + dec AL call FDCDataOutput mov AL, [FDD_Track] call FDCDataOutput @@ -586,6 +589,8 @@ call FDCDataOutput mov AL, [FDD_Head] shl AL, 2 + or AL, [flp_number] + dec AL call FDCDataOutput mov AL, [FDD_Track] call FDCDataOutput |
|
Fix for floppies: r6814. Tested in qemu and bochs. Drive number wasn't specified for recalibrate/read/write commands, always 0. |
Date Modified | Username | Field | Change |
---|---|---|---|
2015-06-16 20:32 | Cameron | New Issue | |
2016-12-24 19:58 | dunkaist | Relationship added | has duplicate 0000103 |
2016-12-24 19:59 | dunkaist | Status | new => confirmed |
2016-12-24 20:01 | dunkaist | Tag Attached: pci | |
2016-12-24 20:01 | dunkaist | Tag Attached: qemu | |
2016-12-24 20:02 | dunkaist | File Added: qemu_pci_bus_master.diff | |
2016-12-24 20:18 | dunkaist | Note Added: 0000188 | |
2016-12-24 20:45 | dunkaist | Note Edited: 0000188 | |
2016-12-26 01:01 | dunkaist | File Added: fd_fd2.diff | |
2016-12-26 01:05 | dunkaist | Note Added: 0000189 | |
2016-12-26 01:24 | dunkaist | Tag Attached: floppy | |
2016-12-26 21:57 | dunkaist | Relationship replaced | duplicate of 0000103 |
2016-12-26 21:57 | dunkaist | Status | confirmed => resolved |
2016-12-26 21:57 | dunkaist | Fixed in Version | => SVN build / автосборка SVN |
2016-12-26 21:57 | dunkaist | Resolution | open => fixed |
2016-12-26 21:57 | dunkaist | Assigned To | => dunkaist |
2016-12-26 21:58 | dunkaist | Relationship replaced | has duplicate 0000103 |
2017-01-22 23:53 | dunkaist | Status | resolved => closed |