VirtualBox

Changeset 39355 in vbox


Ignore:
Timestamp:
Nov 17, 2011 5:25:25 PM (13 years ago)
Author:
vboxsync
Message:

Reshuffled things some more.

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

Legend:

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

    r39340 r39355  
    766766
    767767            // Set nb of sector transferred
    768             SET_AL(read_word(ebda_seg, (uint16_t)&EbdaData->bdisk.trsfsectors));
     768            SET_AL(read_word(ebda_seg, (uint16_t)&EbdaData->bdisk.drqp.trsfsectors));
    769769
    770770            if (status != 0)
     
    882882            }
    883883
    884             count=read_word(ebda_seg, &EbdaData->bdisk.trsfsectors);
     884            count=read_word(ebda_seg, &EbdaData->bdisk.drqp.trsfsectors);
    885885            write_word(DS, SI+(uint16_t)&Int13Ext->count, count);
    886886
  • trunk/src/VBox/Devices/PC/BIOS-new/ata.c

    r39340 r39355  
    267267    }
    268268   
    269     // Reset count of transferred data
    270     AtaData->trsfsectors = 0;
    271     AtaData->trsfbytes   = 0;
    272269    current = 0;
    273270   
     
    322319        }
    323320        current += mult_blk_cnt;
    324         AtaData->trsfsectors = current;
     321        AtaData->drqp.trsfsectors = current;
    325322        count--;
    326323        while (1) {
     
    746743    }
    747744   
    748     // Reset count of transferred data
    749     AtaData->trsfsectors = 0;
    750     AtaData->trsfbytes   = 0;
    751745    current = 0;
    752746   
     
    795789       
    796790        current++;
    797         AtaData->trsfsectors = current;
     791        AtaData->drqp.trsfsectors = current;
    798792        count--;
    799793        while (1) {
     
    877871   
    878872    // Reset count of transferred data
    879     AtaData->trsfsectors = 0;
    880     AtaData->trsfbytes   = 0;
     873    // @todo: clear in calling code?
     874    AtaData->drqp.trsfsectors = 0;
     875    AtaData->drqp.trsfbytes   = 0;
    881876   
    882877    status = inb(iobase1 + ATA_CB_STAT);
     
    10391034            // Save transferred bytes count
    10401035            transfer += count;
    1041             AtaData->trsfbytes = transfer;
     1036            AtaData->drqp.trsfbytes = transfer;
    10421037        }
    10431038    }
  • trunk/src/VBox/Devices/PC/BIOS-new/disk.c

    r39347 r39355  
    157157        }
    158158
     159        /* Reset the count of transferred sectors/bytes. */
     160        bios_dsk->drqp.trsfsectors = 0;
     161        bios_dsk->drqp.trsfbytes   = 0;
     162
    159163        if ( GET_AH() == 0x02 )
    160164        {
     
    179183
    180184        // Set nb of sector transferred
    181         SET_AL(bios_dsk->trsfsectors);
     185        SET_AL(bios_dsk->drqp.trsfsectors);
    182186       
    183187        if (status != 0) {
     
    352356        if (( GET_AH() == 0x44 ) || ( GET_AH() == 0x47 ))
    353357            goto int13x_success;
    354        
     358
     359        /* Reset the count of transferred sectors/bytes. */
     360        bios_dsk->drqp.trsfsectors = 0;
     361        bios_dsk->drqp.trsfbytes   = 0;
     362
    355363        // Execute the command
    356364        if ( GET_AH() == 0x42 ) {
     
    381389        }
    382390
    383         count = bios_dsk->trsfsectors;
     391        count = bios_dsk->drqp.trsfsectors;
    384392        i13_ext->count = count;
    385393       
     
    467475           
    468476            checksum = 0;
    469             for (i=0; i<15; i++)
     477            for (i = 0; i < 15; ++i)
    470478                checksum += read_byte(ebda_seg, (uint16_t)&EbdaData->bdisk.dpte + i);
    471479            checksum = -checksum;
  • trunk/src/VBox/Devices/PC/BIOS-new/ebda.h

    r39346 r39355  
    161161} disk_dev_t;
    162162
     163/* A structure for passing disk request information around. This structure
     164 * is designed for saving stack space. As BIOS requests cannot be overlapped,
     165 * one such structure is sufficient.
     166 */
     167typedef struct {
     168    uint32_t    lba;                /* Starting LBA. */
     169    void __far  *buffer;            /* Read/write data buffer pointer. */
     170    uint16_t    count;              /* Count of sectors to be transferred. */
     171    uint16_t    cylinder;           /* Starting cylinder (CHS only). */
     172    uint16_t    head;               /* Starting head (CHS only). */
     173    uint16_t    sector;             /* Starting sector (CHS only). */
     174    uint16_t    trsfsectors;        /* Actual sectors transferred. */
     175    uint32_t    trsfbytes;          /* Actual bytes transferred. */
     176} disk_req_t;
     177
     178/* All BIOS disk information. Disk-related code in the BIOS should not need
     179 * anything outside of this structure.
     180 */
    163181typedef struct {
    164182    /* ATA bus-specific device information. */
     
    183201
    184202    dpte_t      dpte;               /* Buffer for building a DPTE. */
    185     uint16_t    trsfsectors;        /* Count of sectors transferred. */
    186     uint32_t    trsfbytes;          /* Count of bytes transferred. */
     203    disk_req_t  drqp;               /* Disk request packet. */
    187204} bio_dsk_t;
    188205
  • trunk/src/VBox/Devices/PC/BIOS-new/eltorito.c

    r39340 r39355  
    672672      status = ata_cmd_packet(device, 12, &atacmd, 0, count*2048L, ATA_DATA_IN, MK_FP(segment,offset));
    673673
    674       count = (uint16_t)(ata->trsfbytes >> 11);
     674      count = (uint16_t)(ata->drqp.trsfbytes >> 11);
    675675      write_word(DS, SI+(uint16_t)&Int13Ext->count, count);
    676676
  • trunk/src/VBox/Devices/PC/BIOS-new/inlines.h

    r38851 r39355  
    8787#pragma aux rep_outsd = ".386" "rep outs dx,dword ptr es:[si]" parm [es si] [cx] [dx] value [es si] modify exact [cx si];
    8888
     89uint16_t __far swap_16(uint16_t val);
     90#pragma aux swap_16 = "xchg ah,al" parm [ax] value [ax] modify exact [ax] nomemory;
     91
     92uint32_t __far swap_32(uint32_t val);
     93#pragma aux swap_32 =   \
     94    "xchg   ah, al"     \
     95    "xchg   dh, dl"     \
     96    "xchg   ax, dx"     \
     97    parm [dx ax] value [dx ax] modify exact [dx ax] nomemory;
  • trunk/src/VBox/Devices/PC/BIOS-new/scsi.c

    r39347 r39355  
    2424
    2525
     26//#define VBOX_SCSI_DEBUG 1 /* temporary */
     27
     28#ifdef VBOX_SCSI_DEBUG
     29# define VBSCSI_DEBUG(...)    BX_INFO(__VA_ARGS__)
     30#else
     31# define VBSCSI_DEBUG(...)
     32#endif
     33
     34#define VBSCSI_BUSY (1 << 0)
     35
    2636/* The I/O port of the BusLogic SCSI adapter. */
    2737#define BUSLOGIC_ISA_IO_PORT 0x330
     
    4959#define SCSI_TXDIR_TO_DEVICE   1
    5060
    51 #define VBSCSI_BUSY (1 << 0)
    52 
    53 //#define VBOX_SCSI_DEBUG 1 /* temporary */
    54 
    55 #ifdef VBOX_SCSI_DEBUG
    56 # define VBSCSI_DEBUG(...)    BX_INFO(__VA_ARGS__)
    57 #else
    58 # define VBSCSI_DEBUG(...)
    59 #endif
     61#pragma pack(1)
     62
     63/* READ_10/WRITE_10 CDB layout. */
     64typedef struct {
     65    uint16_t    command;    /* Command. */
     66    uint32_t    lba;        /* LBA, MSB first! */
     67    uint8_t     pad1;       /* Unused. */
     68    uint16_t    nsect;      /* Sector count, MSB first! */
     69    uint8_t     pad2;       /* Unused. */
     70} cdb_rw10;
     71
     72#pragma pack()
     73
     74ct_assert(sizeof(cdb_rw10) == 10);
    6075
    6176int scsi_cmd_data_in(uint16_t io_base, uint8_t device_id, uint8_t __far *aCDB,
     
    146161{
    147162    uint8_t             rc;
    148     uint8_t             aCDB[10];
     163    cdb_rw10            cdb;
    149164    uint16_t            io_base;
    150165    uint8_t             target_id;
     
    154169        BX_PANIC("scsi_read_sectors: device_id out of range %d\n", device_id);
    155170
     171    /* Prepare a CDB. */
     172    cdb.command = SCSI_READ_10;
     173    cdb.lba     = swap_32(lba);
     174    cdb.pad1    = 0;
     175    cdb.nsect   = swap_16(count);
     176    cdb.pad2    = 0;
     177
    156178    bios_dsk = read_word(0x0040, 0x000E) :> &EbdaData->bdisk;
    157 
    158     /* Reset the count of transferred sectors/bytes. */
    159     bios_dsk->trsfsectors = 0;
    160     bios_dsk->trsfbytes   = 0;
    161 
    162     /* Prepare CDB */
    163     //@todo: make CDB a struct, this is stupid
    164     aCDB[0] = SCSI_READ_10;
    165     aCDB[1] = 0;
    166     aCDB[2] = (uint8_t)(lba >> 24);
    167     aCDB[3] = (uint8_t)(lba >> 16);
    168     aCDB[4] = (uint8_t)(lba >>  8);
    169     aCDB[5] = (uint8_t)(lba);
    170     aCDB[6] = 0;
    171     aCDB[7] = (uint8_t)(count >> 8);
    172     aCDB[8] = (uint8_t)(count);
    173     aCDB[9] = 0;
    174179
    175180    io_base   = bios_dsk->scsidev[device_id].io_base;
    176181    target_id = bios_dsk->scsidev[device_id].target_id;
    177182
    178     rc = scsi_cmd_data_in(io_base, target_id, aCDB, 10, buffer, (count * 512));
     183    rc = scsi_cmd_data_in(io_base, target_id, (void __far *)&cdb, 10, buffer, (count * 512));
    179184
    180185    if (!rc)
    181186    {
    182         bios_dsk->trsfsectors = count;
    183         bios_dsk->trsfbytes   = count * 512;
     187        bios_dsk->drqp.trsfsectors = count;
     188        bios_dsk->drqp.trsfbytes   = count * 512;
    184189    }
    185190
     
    199204{
    200205    uint8_t             rc;
    201     uint8_t             aCDB[10];
     206    cdb_rw10            cdb;
    202207    uint16_t            io_base;
    203208    uint8_t             target_id;
     
    207212        BX_PANIC("scsi_write_sectors: device_id out of range %d\n", device_id);
    208213
     214    /* Prepare a CDB. */
     215    cdb.command = SCSI_WRITE_10;
     216    cdb.lba     = swap_32(lba);
     217    cdb.pad1    = 0;
     218    cdb.nsect   = swap_16(count);
     219    cdb.pad2    = 0;
     220
    209221    bios_dsk = read_word(0x0040, 0x000E) :> &EbdaData->bdisk;
    210 
    211     // Reset count of transferred data
    212     bios_dsk->trsfsectors = 0;
    213     bios_dsk->trsfbytes   = 0;
    214 
    215     /* Prepare CDB */
    216     //@todo: make CDB a struct, this is stupid
    217     aCDB[0] = SCSI_WRITE_10;
    218     aCDB[1] = 0;
    219     aCDB[2] = (uint8_t)(lba >> 24);
    220     aCDB[3] = (uint8_t)(lba >> 16);
    221     aCDB[4] = (uint8_t)(lba >>  8);
    222     aCDB[5] = (uint8_t)(lba);
    223     aCDB[6] = 0;
    224     aCDB[7] = (uint8_t)(count >> 8);
    225     aCDB[8] = (uint8_t)(count);
    226     aCDB[9] = 0;
    227222
    228223    io_base   = bios_dsk->scsidev[device_id].io_base;
    229224    target_id = bios_dsk->scsidev[device_id].target_id;
    230225
    231     rc = scsi_cmd_data_out(io_base, target_id, aCDB, 10, buffer, (count * 512));
     226    rc = scsi_cmd_data_out(io_base, target_id, (void __far *)&cdb, 10, buffer, (count * 512));
    232227
    233228    if (!rc)
    234229    {
    235         bios_dsk->trsfsectors = count;
    236         bios_dsk->trsfbytes   = (count * 512);
     230        bios_dsk->drqp.trsfsectors = count;
     231        bios_dsk->drqp.trsfbytes   = (count * 512);
    237232    }
    238233
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