VirtualBox

Changeset 39610 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Dec 14, 2011 2:09:59 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
75390
Message:

Further fixes and more logging.

Location:
trunk/src/VBox/Devices/PC/BIOS-new
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/BIOS-new/ahci.c

    r39598 r39610  
    1515 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
    1616 */
    17 
    18 //@todo!!!! save/restore high bits of EAX/ECX and whatever else may be needed.
    1917
    2018#include <stdint.h>
     
    8785    /** Physical address of the sink buffer (for pre/post skip). */
    8886    uint32_t        sink_buf_phys;
     87    /** Saved high bits of EAX. */
     88    uint16_t        saved_eax_hi;
    8989    /** VDS EDDS DMA buffer descriptor structure. */
    9090    vds_edds        edds;
     
    181181    parm [dx] value [dx ax] modify nomemory;
    182182
     183/* Warning: Destroys high bits of EAX. */
    183184void outpd(uint16_t port, uint32_t val);
    184185#pragma aux outpd =     \
     
    191192
    192193
     194/* Machinery to save/restore high bits of EAX. 32-bit port I/O needs to use
     195 * EAX, but saving/restoring EAX around each port access would be inefficient.
     196 * Instead, each externally callable routine must save the high bits before
     197 * modifying them and restore the high bits before exiting.
     198 */
     199
     200/* Note: Reading high EAX bits destroys them - *must* be restored later. */
     201uint16_t eax_hi_rd(void);
     202#pragma aux eax_hi_rd = \
     203    ".386"              \
     204    "shr    eax, 16"    \
     205    value [ax] modify nomemory;
     206
     207void eax_hi_wr(uint16_t);
     208#pragma aux eax_hi_wr = \
     209    ".386"              \
     210    "shl    eax, 16"    \
     211    parm [ax] modify nomemory;
     212
     213void high_bits_save(ahci_t __far *ahci)
     214{
     215    ahci->saved_eax_hi = eax_hi_rd();
     216}
     217
     218void high_bits_restore(ahci_t __far *ahci)
     219{
     220    eax_hi_wr(ahci->saved_eax_hi);
     221}
     222
    193223/**
    194224 * Sets a given set of bits in a register.
     
    333363
    334364    ahci->cur_prd = prdt_idx;
     365
     366#ifdef DEBUG_AHCI
     367    for (prdt_idx = 0; prdt_idx < ahci->cur_prd; ++prdt_idx) {
     368        DBG_AHCI("S/G entry %u: %5lu bytes @ %08lX\n", prdt_idx,
     369                 ahci->aPrdt[prdt_idx].len + 1, ahci->aPrdt[prdt_idx].phys_addr);
     370    }
     371#endif
    335372
    336373    /* Build variable part of first command DWORD (reuses 'cmd'). */
     
    462499             bios_dsk->ahcidev[device_id].port);
    463500
     501    high_bits_save(bios_dsk->ahci_seg :> 0);
    464502    ahci_port_init(bios_dsk->ahci_seg :> 0, bios_dsk->ahcidev[device_id].port);
    465503    ahci_cmd_data(bios_dsk, AHCI_CMD_READ_DMA_EXT);
     
    467505    rep_movsw(bios_dsk->drqp.buffer, bios_dsk->drqp.buffer, bios_dsk->drqp.nsect * 512 / 2);
    468506#endif
     507    high_bits_restore(bios_dsk->ahci_seg :> 0);
    469508    return 0;   //@todo!!
    470509}
     
    489528             bios_dsk->ahcidev[device_id].port);
    490529
     530    high_bits_save(bios_dsk->ahci_seg :> 0);
    491531    ahci_port_init(bios_dsk->ahci_seg :> 0, bios_dsk->ahcidev[device_id].port);
    492532    ahci_cmd_data(bios_dsk, AHCI_CMD_WRITE_DMA_EXT);
     533    high_bits_restore(bios_dsk->ahci_seg :> 0);
    493534    return 0;   //@todo!!
    494535}
     
    503544{
    504545    bio_dsk_t __far *bios_dsk = read_word(0x0040, 0x000E) :> &EbdaData->bdisk;
    505     ahci_t __far    *ahci     = bios_dsk->ahci_seg :> 0;
     546    ahci_t __far    *ahci;
    506547
    507548    /* Data out is currently not supported. */
     
    530571    bios_dsk->drqp.nsect   = length / bios_dsk->drqp.sect_sz;
    531572//    bios_dsk->drqp.sect_sz = 2048;
     573
     574    ahci = bios_dsk->ahci_seg :> 0;
     575    high_bits_save(ahci);
    532576
    533577    ahci_port_init(bios_dsk->ahci_seg :> 0, bios_dsk->ahcidev[device_id].port);
     
    554598    rep_movsw(bios_dsk->drqp.buffer, bios_dsk->drqp.buffer, bios_dsk->drqp.trsfbytes / 2);
    555599#endif
     600    high_bits_restore(ahci);
     601
    556602    return ahci->aCmdHdr[1] == 0 ? 4 : 0;
    557603//    return 0;   //@todo!!
  • trunk/src/VBox/Devices/PC/BIOS-new/disk.c

    r39560 r39610  
    349349        segment = i13_ext->segment;
    350350        offset  = i13_ext->offset;
    351        
     351
     352        BX_DEBUG_INT13_HD("%s: %d sectors from lba %u @ %04x:%04x\n", __func__,
     353                          count, i13_ext->lba1, segment, offset);
     354
    352355        // Can't use 64 bits lba
    353356        lba = i13_ext->lba2;
     
    379382        bios_dsk->drqp.sect_sz = 512;   //@todo: device specific?
    380383        bios_dsk->drqp.sector  = 0;     /* Indicate LBA. */
     384        bios_dsk->drqp.dev_id  = device;
    381385       
    382386        // Execute the command
  • trunk/src/VBox/Devices/PC/BIOS-new/eltorito.c

    r39597 r39610  
    508508        segment   = ES;
    509509        offset    = BX;
    510        
     510
     511        BX_DEBUG_INT13_ET("%s: read to %04x:%04x @ VCHS %u/%u/%u (%u sectors)\n", __func__,
     512                          ES, BX, cylinder, head, sector, nbsectors);
     513
    511514        // no sector to read ?
    512515        if(nbsectors==0)
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette