Changeset 38899 in vbox for trunk/src/VBox
- Timestamp:
- Sep 29, 2011 9:20:08 AM (13 years ago)
- Location:
- trunk/src/VBox/Devices/PC/BIOS-new
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/BIOS-new/ahci.c
r38897 r38899 27 27 #include "inlines.h" 28 28 #include "pciutil.h" 29 #include "vds.h" 29 30 30 31 #define VBOX_AHCI_DEBUG 0 31 #define VBOX_AHCI_INT13_DEBUG 0 32 #define VBOX_AHCI_INT13_DEBUG 0 32 33 33 34 #if VBOX_AHCI_DEBUG … … 51 52 */ 52 53 #define DMA_WORKAROUND 1 54 55 /* Number of S/G table entries in EDDS. */ 56 #define NUM_EDDS_SG 16 57 53 58 54 59 /** … … 69 74 70 75 /** 76 * AHCI PRDT structure. 77 */ 78 typedef struct 79 { 80 uint32_t phys_addr; 81 uint32_t something; 82 uint32_t reserved; 83 uint32_t len; 84 } ahci_prdt; 85 86 /** 71 87 * AHCI controller data. 72 88 */ … … 83 99 * Must be aligned on 128 byte boundary. 84 100 */ 85 uint8_t abCmd[0x90]; 86 /** Alignment */ 87 uint8_t abAlignment2[0xF0]; 101 uint8_t abCmd[0x80]; 102 /** Physical Region Descriptor Table (PRDT) array. In other 103 * words, a scatter/gather descriptor list. 104 */ 105 ahci_prdt aPrdt[16]; 88 106 /** Memory for the received command FIS area as specified by chapter 4.2.1 89 107 * of the Intel AHCI spec. This area is normally 256 bytes big but to save memory … … 106 124 uint8_t cCdDrives; 107 125 uint8_t aCdIdMap[AHCI_MAX_STORAGE_DEVICES]; 126 /** Number of harddisks detected before the AHCI driver started detection. */ 127 uint8_t cHardDisksOld; 108 128 /** int13 handler to call if given device is not from AHCI. */ 109 129 uint16_t pfnInt13Old; 110 /** Number of harddisks detected before the AHCI driver started detection. */ 111 uint8_t cHardDisksOld; 130 /** VDS EDDS DMA buffer descriptor structure. */ 131 vds_edds edds; 132 vds_sg edds_more_sg[NUM_EDDS_SG - 1]; 112 133 } ahci_t; 113 134 … … 340 361 ahci->abCmd[13] = u8SectCountExp; 341 362 342 /* Prepare PRDT. */ 343 write_dword(ahci_seg, &AhciData->abCmd[0x80], ahci_addr_to_phys(buf)); 344 write_dword(ahci_seg, &AhciData->abCmd[0x8c], (uint32_t)(cbData - 1)); 363 /* Lock memory needed for DMA. */ 364 ahci->edds.num_avail = NUM_EDDS_SG; 365 vds_build_sg_list( &ahci->edds, buf, cbData ); 366 367 /* Set up the PRDT. */ 368 ahci->aPrdt[0].phys_addr = ahci->edds.u.sg[0].phys_addr; 369 ahci->aPrdt[0].len = ahci->edds.u.sg[0].size - 1; 345 370 346 371 ahci_port_cmd_sync(ahci_seg, u16IoBase, fWrite, 0, 5, cbData); 372 373 /* Unlock the buffer again. */ 374 vds_free_sg_list( &ahci->edds ); 347 375 } 348 376 … … 374 402 */ 375 403 //@todo: merge memsets? 376 _fmemset(&ahci->aCmdHdr[0], 0, 0x20);377 _fmemset(&ahci->abCmd[0], 0, 0x84);378 _fmemset(&ahci->abFisRecv[0], 0, 0x60);404 _fmemset(&ahci->aCmdHdr[0], 0, sizeof(ahci->aCmdHdr)); 405 _fmemset(&ahci->abCmd[0], 0, sizeof(ahci->abCmd)); 406 _fmemset(&ahci->abFisRecv[0], 0, sizeof(ahci->abFisRecv)); 379 407 380 408 VBOXAHCI_PORT_WRITE_REG(u16IoBase, u8Port, AHCI_REG_PORT_FB, 0); -
trunk/src/VBox/Devices/PC/BIOS-new/makefile
r38897 r38899 31 31 keyboard.obj disk.obj serial.obj system.obj timepci.obj & 32 32 ps2mouse.obj parallel.obj logo.obj scsi.obj ahci.obj & 33 pciutil.obj pcibio32.obj orgs.obj33 pciutil.obj vds.obj pcibio32.obj orgs.obj 34 34 35 35 vbxbios.rom : vbxbios.bin … … 54 54 clean : .symbolic 55 55 @rm -f *.obj *.err 56 @rm -f vbxbios.bin vbxbios.rom vbxbios.map 56 @rm -f vbxbios.bin vbxbios.rom vbxbios.map vbxbios.sym -
trunk/src/VBox/Devices/PC/BIOS-new/notes.txt
r38699 r38899 23 23 - OS/2 is the only known guest which can run the 16-bit PCI BIOS in protected 24 24 mode (but only if the 32-bit PCI BIOS is unavailable). 25 26 - Any disk reads which use bus-master DMA (AHCI, IDE BM) must use VDS 27 (Virtual DMA Services) when present. Otherwise any reads/writes when the 28 real mode addresses don't map directly to physical addresses will fail 29 horribly. DOS 6.x with EMM386 is a good testcase (esp. loading drivers 30 into UMBs). 25 31 26 32
Note:
See TracChangeset
for help on using the changeset viewer.