Changeset 58818 in vbox for trunk/src/VBox/Devices/PC/BIOS
- Timestamp:
- Nov 23, 2015 12:13:00 PM (9 years ago)
- Location:
- trunk/src/VBox/Devices/PC/BIOS
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/BIOS/ahci.c
r58724 r58818 235 235 parm [ax] modify nomemory; 236 236 237 void high_bits_save(ahci_t __far *ahci)237 void inline high_bits_save(ahci_t __far *ahci) 238 238 { 239 239 ahci->saved_eax_hi = eax_hi_rd(); 240 240 } 241 241 242 void high_bits_restore(ahci_t __far *ahci)242 void inline high_bits_restore(ahci_t __far *ahci) 243 243 { 244 244 eax_hi_wr(ahci->saved_eax_hi); … … 248 248 * Sets a given set of bits in a register. 249 249 */ 250 static void ahci_ctrl_set_bits(uint16_t iobase, uint16_t reg, uint32_t mask)250 static void inline ahci_ctrl_set_bits(uint16_t iobase, uint16_t reg, uint32_t mask) 251 251 { 252 252 outpd(iobase + AHCI_REG_IDX, reg); … … 257 257 * Clears a given set of bits in a register. 258 258 */ 259 static void ahci_ctrl_clear_bits(uint16_t iobase, uint16_t reg, uint32_t mask)259 static void inline ahci_ctrl_clear_bits(uint16_t iobase, uint16_t reg, uint32_t mask) 260 260 { 261 261 outpd(iobase + AHCI_REG_IDX, reg); … … 267 267 * for a register. 268 268 */ 269 static uint8_t ahci_ctrl_is_bit_set(uint16_t iobase, uint16_t reg, uint32_t mask)269 static uint8_t inline ahci_ctrl_is_bit_set(uint16_t iobase, uint16_t reg, uint32_t mask) 270 270 { 271 271 outpd(iobase + AHCI_REG_IDX, reg); … … 343 343 uint16_t n_sect = bios_dsk->drqp.nsect; 344 344 uint16_t sectsz = bios_dsk->drqp.sect_sz; 345 uint16_t prdt_idx;346 345 fis_d2h __far *d2h; 347 346 … … 373 372 vds_build_sg_list(&ahci->edds, bios_dsk->drqp.buffer, (uint32_t)n_sect * sectsz); 374 373 375 prdt_idx = ahci->cur_prd;376 377 374 /* Set up the PRDT. */ 378 ahci->aPrdt[ prdt_idx].len = ahci->edds.u.sg[0].size - 1;379 ahci->aPrdt[ prdt_idx].phys_addr = ahci->edds.u.sg[0].phys_addr;380 ++ prdt_idx;375 ahci->aPrdt[ahci->cur_prd].len = ahci->edds.u.sg[0].size - 1; 376 ahci->aPrdt[ahci->cur_prd].phys_addr = ahci->edds.u.sg[0].phys_addr; 377 ++ahci->cur_prd; 381 378 382 379 if (bios_dsk->drqp.skip_a) { 383 ahci->aPrdt[prdt_idx].len = bios_dsk->drqp.skip_a - 1; 384 ahci->aPrdt[prdt_idx].phys_addr = ahci->sink_buf_phys; 385 ++prdt_idx; 386 } 387 388 ahci->cur_prd = prdt_idx; 389 390 #ifdef DEBUG_AHCI 391 for (prdt_idx = 0; prdt_idx < ahci->cur_prd; ++prdt_idx) { 392 DBG_AHCI("S/G entry %u: %5lu bytes @ %08lX\n", prdt_idx, 393 ahci->aPrdt[prdt_idx].len + 1, ahci->aPrdt[prdt_idx].phys_addr); 380 ahci->aPrdt[ahci->cur_prd].len = bios_dsk->drqp.skip_a - 1; 381 ahci->aPrdt[ahci->cur_prd].phys_addr = ahci->sink_buf_phys; 382 ++ahci->cur_prd; 383 } 384 385 #if DEBUG_AHCI 386 { 387 uint16_t prdt_idx; 388 389 for (prdt_idx = 0; prdt_idx < ahci->cur_prd; ++prdt_idx) { 390 DBG_AHCI("S/G entry %u: %5lu bytes @ %08lX\n", prdt_idx, 391 ahci->aPrdt[prdt_idx].len + 1, ahci->aPrdt[prdt_idx].phys_addr); 392 } 394 393 } 395 394 #endif -
trunk/src/VBox/Devices/PC/BIOS/ata.c
r58724 r58818 207 207 uint16_t ata_cmd_data_in(bio_dsk_t __far *bios_dsk, uint16_t command, uint16_t count) 208 208 { 209 uint64_t lba;210 209 uint16_t iobase1, iobase2, blksize, mult_blk_cnt; 211 210 uint16_t cylinder; 212 uint16_t head; 213 uint16_t sector; 214 uint16_t device; 215 uint8_t channel, slave; 211 uint8_t head; 212 uint8_t sector; 213 uint8_t device; 216 214 uint8_t status, mode; 217 215 char __far *buffer; 218 216 219 217 device = bios_dsk->drqp.dev_id; 220 channel = device / 2; 221 slave = device % 2; 222 223 iobase1 = bios_dsk->channels[channel].iobase1; 224 iobase2 = bios_dsk->channels[channel].iobase2; 218 219 iobase1 = bios_dsk->channels[device / 2].iobase1; 220 iobase2 = bios_dsk->channels[device / 2].iobase2; 225 221 mode = bios_dsk->devices[device].mode; 226 222 blksize = bios_dsk->devices[device].blksize; … … 246 242 } 247 243 248 lba = bios_dsk->drqp.lba;249 244 buffer = bios_dsk->drqp.buffer; 250 245 sector = bios_dsk->drqp.sector; … … 254 249 // sector will be 0 only on lba access. Convert to lba-chs 255 250 if (sector == 0) { 256 if ( lba + count >= 268435456)251 if (bios_dsk->drqp.lba + count >= 268435456) 257 252 { 258 sector = ( lba >> 24) & 0x00ff;259 cylinder = ( lba >> 32) & 0xffff;253 sector = (bios_dsk->drqp.lba >> 24) & 0x00ff; 254 cylinder = (bios_dsk->drqp.lba >> 32) & 0xffff; 260 255 outb(iobase1 + ATA_CB_SC, (count & 0xff00) >> 8); 261 256 outb(iobase1 + ATA_CB_SN, sector); … … 264 259 /* Leave the bottom 24 bits as is, they are treated correctly by the 265 260 * LBA28 code path. */ 266 lba &= 0xffffff; 267 } 268 sector = (uint16_t) (lba & 0x000000ffL); 269 lba >>= 8; 270 cylinder = (uint16_t) (lba & 0x0000ffffL); 271 lba >>= 16; 272 head = ((uint16_t) (lba & 0x0000000fL)) | 0x40; 261 } 262 sector = bios_dsk->drqp.lba & 0x000000ffL; 263 cylinder = (bios_dsk->drqp.lba >> 8) & 0x0000ffffL; 264 head = ((bios_dsk->drqp.lba >> 24) & 0x0000000fL) | 0x40; 273 265 } 274 266 … … 279 271 outb(iobase1 + ATA_CB_CL, cylinder & 0x00ff); 280 272 outb(iobase1 + ATA_CB_CH, cylinder >> 8); 281 outb(iobase1 + ATA_CB_DH, ( slave ? ATA_CB_DH_DEV1 : ATA_CB_DH_DEV0) | (uint8_t)head );273 outb(iobase1 + ATA_CB_DH, ((device & 1) ? ATA_CB_DH_DEV1 : ATA_CB_DH_DEV0) | head ); 282 274 outb(iobase1 + ATA_CB_CMD, command); 283 275
Note:
See TracChangeset
for help on using the changeset viewer.