VirtualBox

Changeset 39583 in vbox for trunk/src/VBox/Devices/PC


Ignore:
Timestamp:
Dec 12, 2011 3:03:44 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
75347
Message:

Updated 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

    r39573 r39583  
    2626#include "vds.h"
    2727
    28 #define VBOX_AHCI_DEBUG         0
    29 
    30 #if VBOX_AHCI_DEBUG
    31 # define VBOXAHCI_DEBUG(...)        BX_INFO(__VA_ARGS__)
     28#if DEBUG_AHCI
     29# define DBG_AHCI(...)        BX_INFO(__VA_ARGS__)
    3230#else
    33 # define VBOXAHCI_DEBUG(...)
     31# define DBG_AHCI(...)
    3432#endif
    3533
     
    258256
    259257        /* Wait for a D2H FIS. */
    260         VBOXAHCI_DEBUG("AHCI: Waiting for D2H FIS\n");
     258        DBG_AHCI("AHCI: Waiting for D2H FIS\n");
    261259        while (ahci_ctrl_is_bit_set(io_base, AHCI_PORT_REG(port, AHCI_REG_PORT_IS),
    262260                                    AHCI_REG_PORT_IS_DHRS) == 0)
     
    275273    }
    276274    else
    277         VBOXAHCI_DEBUG("AHCI: Invalid port given\n");
     275        DBG_AHCI("AHCI: Invalid port given\n");
    278276}
    279277
     
    353351                                    AHCI_REG_PORT_CMD_FRE | AHCI_REG_PORT_CMD_ST | AHCI_REG_PORT_CMD_FR | AHCI_REG_PORT_CMD_CR) == 1)
    354352        {
    355             VBOXAHCI_DEBUG("AHCI: Waiting for the port to idle\n");
     353            DBG_AHCI("AHCI: Waiting for the port to idle\n");
    356354        }
    357355
     
    394392                                AHCI_REG_PORT_CMD_FRE | AHCI_REG_PORT_CMD_ST | AHCI_REG_PORT_CMD_FR | AHCI_REG_PORT_CMD_CR) == 1)
    395393    {
    396         VBOXAHCI_DEBUG("AHCI: Waiting for the port to idle\n");
     394        DBG_AHCI("AHCI: Waiting for the port to idle\n");
    397395    }
    398396
     
    406404    _fmemset(&ahci->abFisRecv[0], 0, sizeof(ahci->abFisRecv));
    407405
    408     VBOXAHCI_DEBUG("AHCI: FIS receive area %lx from %x:%x\n", ahci_addr_to_phys(&ahci->abFisRecv), FP_SEG(ahci), &AhciData->abFisRecv);
     406    DBG_AHCI("AHCI: FIS receive area %lx from %x:%x\n",
     407             ahci_addr_to_phys(&ahci->abFisRecv), FP_SEG(ahci), &AhciData->abFisRecv);
    409408    VBOXAHCI_PORT_WRITE_REG(ahci->iobase, u8Port, AHCI_REG_PORT_FB, ahci_addr_to_phys(&ahci->abFisRecv));
    410409    VBOXAHCI_PORT_WRITE_REG(ahci->iobase, u8Port, AHCI_REG_PORT_FBU, 0);
    411410
    412     VBOXAHCI_DEBUG("AHCI: CMD list area %lx\n", ahci_addr_to_phys(&ahci->aCmdHdr));
     411    DBG_AHCI("AHCI: CMD list area %lx\n", ahci_addr_to_phys(&ahci->aCmdHdr));
    413412    VBOXAHCI_PORT_WRITE_REG(ahci->iobase, u8Port, AHCI_REG_PORT_CLB, ahci_addr_to_phys(&ahci->aCmdHdr));
    414413    VBOXAHCI_PORT_WRITE_REG(ahci->iobase, u8Port, AHCI_REG_PORT_CLBU, 0);
     
    438437        BX_PANIC("%s: device_id out of range %d\n", __func__, device_id);
    439438
    440     VBOXAHCI_DEBUG("%s: %u sectors @ LBA %lu, device %d, port %d\n", __func__,
    441                    bios_dsk->drqp.nsect, bios_dsk->drqp.lba, device_id,
    442                    bios_dsk->ahcidev[device_id].port);
     439    DBG_AHCI("%s: %u sectors @ LBA %lu, device %d, port %d\n", __func__,
     440             bios_dsk->drqp.nsect, bios_dsk->drqp.lba, device_id,
     441             bios_dsk->ahcidev[device_id].port);
    443442
    444443    ahci_port_init(bios_dsk->ahci_seg :> 0, bios_dsk->ahcidev[device_id].port);
     
    465464        BX_PANIC("%s: device_id out of range %d\n", __func__, device_id);
    466465
    467     VBOXAHCI_DEBUG("%s: %u sectors @ LBA %lu, device %d, port %d\n", __func__,
    468                    bios_dsk->drqp.nsect, bios_dsk->drqp.lba, device_id,
    469                    bios_dsk->ahcidev[device_id].port);
     466    DBG_AHCI("%s: %u sectors @ LBA %lu, device %d, port %d\n", __func__,
     467             bios_dsk->drqp.nsect, bios_dsk->drqp.lba, device_id,
     468             bios_dsk->ahcidev[device_id].port);
    470469
    471470    ahci_port_init(bios_dsk->ahci_seg :> 0, bios_dsk->ahcidev[device_id].port);
     
    493492    /* The header length must be even. */
    494493    if (header & 1) {
    495         VBOXAHCI_DEBUG("%s: header must be even (%04x)\n", __func__, header);
     494        DBG_AHCI("%s: header must be even (%04x)\n", __func__, header);
    496495        return 1;
    497496    }
     
    500499    device_id = device_id - BX_MAX_ATA_DEVICES - BX_MAX_SCSI_DEVICES;
    501500
    502     VBOXAHCI_DEBUG("%s: reading %lu bytes, header %u, device %d, port %d\n", __func__,
    503                    length, header, device_id, bios_dsk->ahcidev[device_id].port);
     501    DBG_AHCI("%s: reading %lu bytes, header %u, device %d, port %d\n", __func__,
     502             length, header, device_id, bios_dsk->ahcidev[device_id].port);
     503    DBG_AHCI("%s: reading %u %u-byte sectors\n", __func__,
     504             bios_dsk->drqp.nsect, bios_dsk->drqp.sect_sz);
    504505
    505506    bios_dsk->drqp.lba     = (uint32_t)length << 8;     //@todo: xfer length limit
    506507    bios_dsk->drqp.buffer  = buffer;
    507     bios_dsk->drqp.nsect   = length / 2048;
    508     bios_dsk->drqp.sect_sz = 2048;
     508//    bios_dsk->drqp.nsect   = length / 2048;
     509//    bios_dsk->drqp.sect_sz = 2048;
    509510
    510511    ahci_port_init(bios_dsk->ahci_seg :> 0, bios_dsk->ahcidev[device_id].port);
     
    519520
    520521    ahci_cmd_data(bios_dsk, ATA_CMD_PACKET);
    521     VBOXAHCI_DEBUG("%s: transferred %lu bytes\n", __func__, ahci->aCmdHdr[1]);
     522    DBG_AHCI("%s: transferred %lu bytes\n", __func__, ahci->aCmdHdr[1]);
    522523    bios_dsk->drqp.trsfbytes = ahci->aCmdHdr[1];
    523524#ifdef DMA_WORKAROUND
     
    556557        devcount_ahci = bios_dsk->ahci_devcnt;
    557558
    558         VBOXAHCI_DEBUG("AHCI: Device detected on port %d\n", u8Port);
     559        DBG_AHCI("AHCI: Device detected on port %d\n", u8Port);
    559560
    560561        //@todo: Merge common HD/CDROM detection code
     
    573574                uint8_t     idxCmosChsBase;
    574575
    575                 VBOXAHCI_DEBUG("AHCI: Detected hard disk\n");
     576                DBG_AHCI("AHCI: Detected hard disk\n");
    576577
    577578                /* Identify device. */
     
    595596                    cSectors = *(uint16_t *)(abBuffer+(100*2)); // words 100 to 103 (someday)
    596597
    597                 VBOXAHCI_DEBUG("AHCI: %ld sectors\n", cSectors);
     598                DBG_AHCI("AHCI: %ld sectors\n", cSectors);
    598599
    599600                bios_dsk->ahcidev[devcount_ahci].port = u8Port;
     
    640641                    cSectorsPerTrack = 0;
    641642                }
    642                 VBOXAHCI_DEBUG("AHCI: Dev %d LCHS=%d/%d/%d\n",
    643                                devcount_ahci, cCylinders, cHeads, cSectorsPerTrack);
     643                DBG_AHCI("AHCI: Dev %d LCHS=%d/%d/%d\n",
     644                         devcount_ahci, cCylinders, cHeads, cSectorsPerTrack);
    644645
    645646                bios_dsk->devices[hd_index].lchs.heads     = cHeads;
     
    660661            else if (val == 0xeb140101)
    661662            {
    662                 VBOXAHCI_DEBUG("AHCI: Detected ATAPI device\n");
     663                DBG_AHCI("AHCI: Detected ATAPI device\n");
    663664
    664665                /* Identify packet device. */
     
    687688            }
    688689            else
    689                 VBOXAHCI_DEBUG("AHCI: Ignoring unknown device\n");
     690                DBG_AHCI("AHCI: Ignoring unknown device\n");
    690691
    691692            devcount_ahci++;
     
    693694        }
    694695        else
    695             VBOXAHCI_DEBUG("AHCI: Reached maximum device count, skipping\n");
     696            DBG_AHCI("AHCI: Reached maximum device count, skipping\n");
    696697    }
    697698}
     
    707708    base_mem_kb = read_word(0x00, 0x0413);
    708709
    709     VBOXAHCI_DEBUG("AHCI: %dK of base mem\n", base_mem_kb);
     710    DBG_AHCI("AHCI: %dK of base mem\n", base_mem_kb);
    710711
    711712    if (base_mem_kb == 0)
     
    733734
    734735    AHCI_READ_REG(io_base, AHCI_REG_VS, val);
    735     VBOXAHCI_DEBUG("AHCI: Controller has version: 0x%x (major) 0x%x (minor)\n",
    736                    ahci_ctrl_extract_bits(val, 0xffff0000, 16),
    737                    ahci_ctrl_extract_bits(val, 0x0000ffff,  0));
     736    DBG_AHCI("AHCI: Controller version: 0x%x (major) 0x%x (minor)\n",
     737             ahci_ctrl_extract_bits(val, 0xffff0000, 16),
     738             ahci_ctrl_extract_bits(val, 0x0000ffff,  0));
    738739
    739740    /* Allocate 1K of base memory. */
     
    741742    if (ahci_seg == 0)
    742743    {
    743         VBOXAHCI_DEBUG("AHCI: Could not allocate 1K of memory, can't boot from controller\n");
     744        DBG_AHCI("AHCI: Could not allocate 1K of memory, can't boot from controller\n");
    744745        return 0;
    745746    }
    746     VBOXAHCI_DEBUG("AHCI: ahci_seg=%04x, size=%04x, pointer at EBDA:%04x (EBDA size=%04x)\n",
    747                    ahci_seg, sizeof(ahci_t), (uint16_t)&EbdaData->bdisk.ahci_seg, sizeof(ebda_data_t));
     747    DBG_AHCI("AHCI: ahci_seg=%04x, size=%04x, pointer at EBDA:%04x (EBDA size=%04x)\n",
     748             ahci_seg, sizeof(ahci_t), (uint16_t)&EbdaData->bdisk.ahci_seg, sizeof(ebda_data_t));
    748749
    749750    write_word(ebda_seg, (uint16_t)&EbdaData->bdisk.ahci_seg, ahci_seg);
     
    762763    cPorts = ahci_ctrl_extract_bits(val, 0x1f, 0) + 1; /* Extract number of ports.*/
    763764
    764     VBOXAHCI_DEBUG("AHCI: HBA has %u ports\n", cPorts);
     765    DBG_AHCI("AHCI: HBA has %u ports\n", cPorts);
    765766
    766767    /* Go through the ports. */
     
    770771        if (ahci_ctrl_is_bit_set(io_base, AHCI_REG_PI, RT_BIT_32(i)) != 0)
    771772        {
    772             VBOXAHCI_DEBUG("AHCI: Port %u is present\n", i);
     773            DBG_AHCI("AHCI: Port %u is present\n", i);
    773774            ahci_port_detect_device(ahci_seg :> 0, i);
    774775            cPorts--;
     
    798799        u8DevFn = busdevfn & 0x00ff;
    799800
    800         VBOXAHCI_DEBUG("AHCI HBA at Bus %u DevFn 0x%x (raw 0x%x)\n", u8Bus, u8DevFn, busdevfn);
     801        DBG_AHCI("AHCI HBA at Bus %u DevFn 0x%x (raw 0x%x)\n", u8Bus, u8DevFn, busdevfn);
    801802
    802803        /* Examine the capability list and search for the Serial ATA Capability Register. */
     
    807808            uint8_t     u8PciCapId = pci_read_config_byte(u8Bus, u8DevFn, u8PciCapOff);
    808809
    809             VBOXAHCI_DEBUG("Capability ID 0x%x at 0x%x\n", u8PciCapId, u8PciCapOff);
     810            DBG_AHCI("Capability ID 0x%x at 0x%x\n", u8PciCapId, u8PciCapOff);
    810811
    811812            if (u8PciCapId == PCI_CAP_ID_SATACR)
     
    820821            uint8_t     u8Rev;
    821822
    822             VBOXAHCI_DEBUG("AHCI HBA with SATA Capability register at 0x%x\n", u8PciCapOff);
     823            DBG_AHCI("AHCI HBA with SATA Capability register at 0x%x\n", u8PciCapOff);
    823824
    824825            /* Advance to the stuff behind the id and next capability pointer. */
     
    833834                uint16_t    u16BarOff = pci_read_config_word(u8Bus, u8DevFn, u8PciCapOff + 2);
    834835
    835                 VBOXAHCI_DEBUG("SATACR1: 0x%x\n", u16BarOff);
     836                DBG_AHCI("SATACR1: 0x%x\n", u16BarOff);
    836837
    837838                switch (u16BarOff & 0xf)
     
    858859                    default:
    859860                        /* Reserved or unsupported. */
    860                         VBOXAHCI_DEBUG("BAR 0x%x unsupported\n", u16BarOff & 0xf);
     861                        DBG_AHCI("BAR 0x%x unsupported\n", u16BarOff & 0xf);
    861862                }
    862863
     
    868869                    uint32_t    u32Bar = pci_read_config_dword(u8Bus, u8DevFn, u8Bar);
    869870
    870                     VBOXAHCI_DEBUG("BAR at 0x%x : 0x%x\n", u8Bar, u32Bar);
     871                    DBG_AHCI("BAR at 0x%x : 0x%x\n", u8Bar, u32Bar);
    871872
    872873                    if ((u32Bar & 0x01) != 0)
     
    875876                        uint16_t    u16AhciIoBase = (u32Bar & 0xfff0) + u16Off;
    876877
    877                         VBOXAHCI_DEBUG("I/O base: 0x%x\n", u16AhciIoBase);
     878                        DBG_AHCI("I/O base: 0x%x\n", u16AhciIoBase);
    878879                        rc = ahci_hba_init(u16AhciIoBase);
    879880                    }
    880881                    else
    881                         VBOXAHCI_DEBUG("BAR is MMIO\n");
     882                        DBG_AHCI("BAR is MMIO\n");
    882883                }
    883884            }
    884885            else
    885                 VBOXAHCI_DEBUG("Invalid revision 0x%x\n", u8Rev);
     886                DBG_AHCI("Invalid revision 0x%x\n", u8Rev);
    886887        }
    887888        else
    888             VBOXAHCI_DEBUG("AHCI HBA with no usable Index/Data register pair!\n");
     889            DBG_AHCI("AHCI HBA with no usable Index/Data register pair!\n");
    889890    }
    890891    else
    891         VBOXAHCI_DEBUG("No AHCI HBA!\n");
    892 }
     892        DBG_AHCI("No AHCI HBA!\n");
     893}
  • trunk/src/VBox/Devices/PC/BIOS-new/biosint.h

    r39366 r39583  
    5252
    5353#define DEBUG_ATA       0
     54#define DEBUG_AHCI      0
     55#define DEBUG_CD_BOOT   0
    5456#define DEBUG_ELTORITO  0
    5557#define DEBUG_INT13_HD  0
  • trunk/src/VBox/Devices/PC/BIOS-new/eltorito.c

    r39575 r39583  
    5959#endif
    6060
    61 //@todo: call this something else? ET_BOOT?
    62 #if DEBUG_ELTORITO
     61#if DEBUG_CD_BOOT
    6362#  define BX_DEBUG_ELTORITO(...)    BX_DEBUG(__VA_ARGS__)
    6463#else
     
    234233{
    235234    // @TODO: a macro or a function for getting the EBDA segment
    236     uint16_t        ebda_seg=read_word(0x0040,0x000E);
    237     uint8_t         buffer[2048];
    238     cdb_atapi       atapicmd;
    239     uint32_t        lba;
    240     uint16_t        boot_segment, nbsectors, i, error;
    241     uint8_t         device;
    242     uint8_t         read_try;
    243     cdemu_t __far   *cdemu;
    244 
    245     cdemu = ebda_seg :> &EbdaData->cdemu;
     235    uint16_t            ebda_seg=read_word(0x0040,0x000E);
     236    uint8_t             buffer[2048];
     237    cdb_atapi           atapicmd;
     238    uint32_t            lba;
     239    uint16_t            boot_segment, nbsectors, i, error;
     240    uint8_t             device;
     241    uint8_t             read_try;
     242    cdemu_t __far       *cdemu;
     243    bio_dsk_t __far     *bios_dsk;
     244
     245    cdemu    = ebda_seg :> &EbdaData->cdemu;
     246    bios_dsk = ebda_seg :> &EbdaData->bdisk;
    246247
    247248    /* Find the first CD-ROM. */
     
    259260    atapicmd.command = 0x28;    // READ 10 command
    260261    atapicmd.lba     = swap_32(0x11);
    261     atapicmd.nsect   = swap_16(0x01);
     262    atapicmd.nsect   = swap_16(1);
     263
     264    bios_dsk->drqp.nsect   = 1;
     265    bios_dsk->drqp.sect_sz = 2048;
    262266
    263267    for (read_try = 0; read_try <= 4; ++read_try)
     
    286290            return 6;
    287291
    288     //@todo: this swaps the LBA back and forth for no good reason??!
    289292    // ok, now we calculate the Boot catalog address
    290293    lba = *((uint32_t *)&buffer[0x47]);
     
    292295
    293296    /* Now we read the Boot Catalog. */
    294     _fmemset(&atapicmd, 0, sizeof(atapicmd));   //@todo: should be redundant
    295297    atapicmd.command = 0x28;    // READ 10 command
    296298    atapicmd.lba     = swap_32(lba);
    297     atapicmd.nsect   = swap_16(0x01);
     299    atapicmd.nsect   = swap_16(1);
     300
     301#if 0   // Not necessary as long as previous values are reused
     302    bios_dsk->drqp.nsect   = 1;
     303    bios_dsk->drqp.sect_sz = 512;
     304#endif
    298305
    299306    if (device > BX_MAX_ATA_DEVICES)
     
    352359
    353360    /* Read the disk image's boot sector into memory. */
    354     _fmemset(&atapicmd, 0, sizeof(atapicmd));   //@todo: should be redundant
    355361    atapicmd.command = 0x28;    // READ 10 command
    356362    atapicmd.lba     = swap_32(lba);
    357363    atapicmd.nsect   = swap_16(1 + (nbsectors - 1) / 4);
     364
     365    bios_dsk->drqp.nsect   = 1 + (nbsectors - 1) / 4;
     366    bios_dsk->drqp.sect_sz = 512;
    358367
    359368    if (device > BX_MAX_ATA_DEVICES)
     
    419428{
    420429    // @TODO: a macro or a function for getting the EBDA segment
    421     uint16_t        ebda_seg=read_word(0x0040,0x000E);
    422     uint8_t         device, status;
    423     uint16_t        vheads, vspt, vcylinders;
    424     uint16_t        head, sector, cylinder, nbsectors;
    425     uint32_t        vlba, ilba, slba, elba;
    426     uint16_t        before, segment, offset;
    427     cdb_atapi       atapicmd;
    428     cdemu_t __far   *cdemu;
    429 
    430     cdemu = ebda_seg :> &EbdaData->cdemu;
     430    uint16_t            ebda_seg=read_word(0x0040,0x000E);
     431    uint8_t             device, status;
     432    uint16_t            vheads, vspt, vcylinders;
     433    uint16_t            head, sector, cylinder, nbsectors;
     434    uint32_t            vlba, ilba, slba, elba;
     435    uint16_t            before, segment, offset;
     436    cdb_atapi           atapicmd;
     437    cdemu_t __far       *cdemu;
     438    bio_dsk_t __far     *bios_dsk;
     439
     440    cdemu    = ebda_seg :> &EbdaData->cdemu;
     441    bios_dsk = ebda_seg :> &EbdaData->bdisk;
    431442
    432443    BX_DEBUG_INT13_ET("%s: AX=%04x BX=%04x CX=%04x DX=%04x ES=%04x\n", __func__, AX, BX, CX, DX, ES);
     
    528539        atapicmd.lba     = swap_32(ilba + slba);
    529540        atapicmd.nsect   = swap_16(elba - slba + 1);
     541
     542        bios_dsk->drqp.nsect   = elba - slba + 1;
     543        bios_dsk->drqp.sect_sz = 512;
    530544
    531545        if (device > BX_MAX_ATA_DEVICES)
     
    726740        atapicmd.lba     = swap_32(lba);
    727741        atapicmd.nsect   = swap_16(count);
     742
     743        bios_dsk->drqp.nsect   = count;
     744        bios_dsk->drqp.sect_sz = 2048;
    728745
    729746        if (device > BX_MAX_ATA_DEVICES)
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