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