| 1 | /******************************************************************************
|
|---|
| 2 | *
|
|---|
| 3 | * Copyright (c) 2013-2016 David Azarewicz
|
|---|
| 4 | *
|
|---|
| 5 | */
|
|---|
| 6 |
|
|---|
| 7 | #include "os2ahci.h"
|
|---|
| 8 |
|
|---|
| 9 | /* -------------------------- macros and constants ------------------------- */
|
|---|
| 10 |
|
|---|
| 11 | /* ------------------------ typedefs and structures ------------------------ */
|
|---|
| 12 |
|
|---|
| 13 | /* -------------------------- function prototypes -------------------------- */
|
|---|
| 14 |
|
|---|
| 15 | /* ------------------------ global/static variables ------------------------ */
|
|---|
| 16 |
|
|---|
| 17 | /* ----------------------------- start of code ----------------------------- */
|
|---|
| 18 |
|
|---|
| 19 | /******************************************************************************
|
|---|
| 20 | * Create adapter/port/device list for user output.
|
|---|
| 21 | */
|
|---|
| 22 | void build_user_info(void)
|
|---|
| 23 | {
|
|---|
| 24 | int a;
|
|---|
| 25 | int p;
|
|---|
| 26 | int d;
|
|---|
| 27 | int iFlag;
|
|---|
| 28 |
|
|---|
| 29 | for (a = 0; a < ad_info_cnt; a++)
|
|---|
| 30 | {
|
|---|
| 31 | AD_INFO *ai = ad_infos + a;
|
|---|
| 32 |
|
|---|
| 33 | dprintf(0,"Adapter %d: PCI=%d:%d:%d ID=%04x:%04x %s %s irq=%d addr=0x%x version=%x\n", a,
|
|---|
| 34 | PCI_BUS_FROM_BDF(ai->bus_dev_func), PCI_DEV_FROM_BDF(ai->bus_dev_func),
|
|---|
| 35 | PCI_FUNC_FROM_BDF(ai->bus_dev_func),
|
|---|
| 36 | ai->pci_vendor, ai->pci_device, vendor_from_id(ai->pci_vendor), ai->pci->chipname,
|
|---|
| 37 | ai->irq, ai->mmio_phys,
|
|---|
| 38 | ai->bios_config[HOST_VERSION / sizeof(u32)]);
|
|---|
| 39 |
|
|---|
| 40 | for (p = 0; p < ai->hw_ports; p++)
|
|---|
| 41 | {
|
|---|
| 42 | P_INFO *pi = &ai->ports[p];
|
|---|
| 43 | iFlag = 1;
|
|---|
| 44 |
|
|---|
| 45 | for (d = 0; d <= pi->dev_max; d++)
|
|---|
| 46 | {
|
|---|
| 47 | if (pi->devs[d].present)
|
|---|
| 48 | {
|
|---|
| 49 | if (iFlag) dprintf(0," Port %d:\n", p);
|
|---|
| 50 | iFlag = 0;
|
|---|
| 51 | dprintf(0," Drive %d:", d);
|
|---|
| 52 | if (pi->devs[d].atapi) dprintf(0," atapi");
|
|---|
| 53 | if (pi->devs[d].removable) dprintf(0," removable");
|
|---|
| 54 | if (pi->devs[d].dev_info.Method != NULL)
|
|---|
| 55 | {
|
|---|
| 56 | dprintf(0," %d cylinders, %d heads, %d sectors per track (%dMB) (%s)",
|
|---|
| 57 | pi->devs[d].dev_info.Cylinders, pi->devs[d].dev_info.HeadsPerCylinder, pi->devs[d].dev_info.SectorsPerTrack,
|
|---|
| 58 | pi->devs[d].dev_info.TotalSectors/2048, pi->devs[d].dev_info.Method);
|
|---|
| 59 | }
|
|---|
| 60 | dprintf(0,"\n");
|
|---|
| 61 | dprintf(0," Model: %s\n", pi->devs[d].dev_name);
|
|---|
| 62 | }
|
|---|
| 63 | else if (verbosity > 0)
|
|---|
| 64 | {
|
|---|
| 65 | if (iFlag) dprintf(0," Port %d:\n", p);
|
|---|
| 66 | iFlag = 0;
|
|---|
| 67 | dprintf(0," No drive present\n");
|
|---|
| 68 | } /* if */
|
|---|
| 69 | } /* for d */
|
|---|
| 70 | } /* for p */
|
|---|
| 71 | } /* for a */
|
|---|
| 72 | }
|
|---|
| 73 |
|
|---|
| 74 | #ifdef DEBUG
|
|---|
| 75 | void DumpIorb(IORBH *pIorb)
|
|---|
| 76 | {
|
|---|
| 77 | if (D32g_DbgLevel < 2) return;
|
|---|
| 78 | if (!ad_infos[iorb_unit_adapter(pIorb)].ports[iorb_unit_port(pIorb)].devs[iorb_unit_device(pIorb)].atapi) return;
|
|---|
| 79 |
|
|---|
| 80 | dprintf(0,"IORB %x: Size=%x Len=%x Handle=%x CmdCode=%x\n",
|
|---|
| 81 | pIorb, sizeof(IORBH), pIorb->Length, pIorb->UnitHandle, pIorb->CommandCode);
|
|---|
| 82 | dprintf(0," CmdMod=%x ReqCtrl=%x Status=%x ErrorCode=%x\n",
|
|---|
| 83 | pIorb->CommandModifier, pIorb->RequestControl, pIorb->Status, pIorb->ErrorCode);
|
|---|
| 84 | dprintf(0," Timeout=%x StatusBlkLen=%x pStatusBlk=%x Res=%x pNxtIORB=%x\n",
|
|---|
| 85 | pIorb->Timeout, pIorb->StatusBlockLen, pIorb->pStatusBlock, pIorb->Reserved_1,
|
|---|
| 86 | pIorb->pNxtIORB);
|
|---|
| 87 | }
|
|---|
| 88 | #endif
|
|---|
| 89 |
|
|---|