VirtualBox

Changeset 38899 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Sep 29, 2011 9:20:08 AM (13 years ago)
Author:
vboxsync
Message:

First cut at VDS support in AHCI BIOS.

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  
    2727#include "inlines.h"
    2828#include "pciutil.h"
     29#include "vds.h"
    2930
    3031#define VBOX_AHCI_DEBUG         0
    31 #define VBOX_AHCI_INT13_DEBUG   0 
     32#define VBOX_AHCI_INT13_DEBUG   0
    3233
    3334#if VBOX_AHCI_DEBUG
     
    5152 */
    5253#define DMA_WORKAROUND      1
     54
     55/* Number of S/G table entries in EDDS. */
     56#define NUM_EDDS_SG         16
     57
    5358
    5459/**
     
    6974
    7075/**
     76 * AHCI PRDT structure.
     77 */
     78typedef struct
     79{
     80    uint32_t    phys_addr;
     81    uint32_t    something;
     82    uint32_t    reserved;
     83    uint32_t    len;
     84} ahci_prdt;
     85
     86/**
    7187 * AHCI controller data.
    7288 */
     
    8399     *  Must be aligned on 128 byte boundary.
    84100     */
    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];
    88106    /** Memory for the received command FIS area as specified by chapter 4.2.1
    89107     *  of the Intel AHCI spec. This area is normally 256 bytes big but to save memory
     
    106124    uint8_t         cCdDrives;
    107125    uint8_t         aCdIdMap[AHCI_MAX_STORAGE_DEVICES];
     126    /** Number of harddisks detected before the AHCI driver started detection. */
     127    uint8_t         cHardDisksOld;
    108128    /** int13 handler to call if given device is not from AHCI. */
    109129    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];
    112133} ahci_t;
    113134
     
    340361    ahci->abCmd[13] = u8SectCountExp;
    341362
    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;
    345370
    346371    ahci_port_cmd_sync(ahci_seg, u16IoBase, fWrite, 0, 5, cbData);
     372
     373    /* Unlock the buffer again. */
     374    vds_free_sg_list( &ahci->edds );
    347375}
    348376
     
    374402         */
    375403        //@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));
    379407
    380408        VBOXAHCI_PORT_WRITE_REG(u16IoBase, u8Port, AHCI_REG_PORT_FB, 0);
  • trunk/src/VBox/Devices/PC/BIOS-new/makefile

    r38897 r38899  
    3131        keyboard.obj disk.obj serial.obj system.obj timepci.obj &
    3232        ps2mouse.obj parallel.obj logo.obj scsi.obj ahci.obj &
    33         pciutil.obj pcibio32.obj orgs.obj
     33        pciutil.obj vds.obj pcibio32.obj orgs.obj
    3434
    3535vbxbios.rom : vbxbios.bin
     
    5454clean : .symbolic
    5555        @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  
    2323- OS/2 is the only known guest which can run the 16-bit PCI BIOS in protected
    2424  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).
    2531
    2632
Note: See TracChangeset for help on using the changeset viewer.

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