VirtualBox

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


Ignore:
Timestamp:
Jun 15, 2011 7:43:59 AM (14 years ago)
Author:
vboxsync
Message:

fdc: Take head count into account.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/fdc.c

    r37459 r37460  
    189189} fdrive_t;
    190190
     191#define NUM_HEADS(drv)      (drv->flags & FDISK_DBL_SIDES ? 2 : 1)
     192
    191193static void fd_init(fdrive_t *drv)
    192194{
     
    200202
    201203static int fd_sector_calc(uint8_t head, uint8_t track, uint8_t sect,
    202                           uint8_t last_sect)
    203 {
    204     return (((track * 2) + head) * last_sect) + sect - 1; /* sect >= 1 */
     204                          uint8_t last_sect, uint8_t num_heads)
     205{
     206    return (((track * num_heads) + head) * last_sect) + sect - 1; /* sect >= 1 */
    205207}
    206208
     
    208210static int fd_sector(fdrive_t *drv)
    209211{
    210     return fd_sector_calc(drv->head, drv->track, drv->sect, drv->last_sect);
     212    return fd_sector_calc(drv->head, drv->track, drv->sect, drv->last_sect, NUM_HEADS(drv));
    211213}
    212214
     
    239241        return 3;
    240242    }
    241     sector = fd_sector_calc(head, track, sect, drv->last_sect);
     243    sector = fd_sector_calc(head, track, sect, drv->last_sect, NUM_HEADS(drv));
    242244    ret = 0;
    243245    if (sector != fd_sector(drv)) {
     
    11591161    FLOPPY_DPRINTF("Start transfer at %d %d %02x %02x (%d)\n",
    11601162                   GET_CUR_DRV(fdctrl), kh, kt, ks,
    1161                    fd_sector_calc(kh, kt, ks, cur_drv->last_sect));
     1163                   fd_sector_calc(kh, kt, ks, cur_drv->last_sect, NUM_HEADS(cur_drv)));
    11621164    switch (fd_seek(cur_drv, kh, kt, ks, fdctrl->config & FD_CONFIG_EIS)) {
    11631165    case 2:
     
    15701572    FLOPPY_DPRINTF("format sector at %d %d %02x %02x (%d)\n",
    15711573                   GET_CUR_DRV(fdctrl), kh, kt, ks,
    1572                    fd_sector_calc(kh, kt, ks, cur_drv->last_sect));
     1574                   fd_sector_calc(kh, kt, ks, cur_drv->last_sect, NUM_HEADS(cur_drv)));
    15731575    switch (fd_seek(cur_drv, kh, kt, ks, fdctrl->config & FD_CONFIG_EIS)) {
    15741576    case 2:
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