1 | /******************************************************************************
|
---|
2 | *
|
---|
3 | * Copyright (c) 2013-2018 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->port_max; 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 | if (pi->devs[d].ignored) dprintf(0," Not a usable disk");
|
---|
61 | dprintf(0,"\n");
|
---|
62 | dprintf(0," Model: %s\n", pi->devs[d].dev_name);
|
---|
63 | }
|
---|
64 | else if (verbosity > 0)
|
---|
65 | {
|
---|
66 | if (iFlag) dprintf(0," Port %d:\n", p);
|
---|
67 | iFlag = 0;
|
---|
68 | dprintf(0," No drive present\n");
|
---|
69 | } /* if */
|
---|
70 | } /* for d */
|
---|
71 | } /* for p */
|
---|
72 | } /* for a */
|
---|
73 | }
|
---|
74 |
|
---|
75 | #ifdef DEBUG
|
---|
76 | void DumpIorb(IORBH *pIorb)
|
---|
77 | {
|
---|
78 | if (D32g_DbgLevel < 2) return;
|
---|
79 | if (!ad_infos[iorb_unit_adapter(pIorb)].ports[iorb_unit_port(pIorb)].devs[iorb_unit_device(pIorb)].atapi) return;
|
---|
80 |
|
---|
81 | dprintf(0,"IORB %x: Size=%x Len=%x Handle=%x CmdCode=%x\n",
|
---|
82 | pIorb, sizeof(IORBH), pIorb->Length, pIorb->UnitHandle, pIorb->CommandCode);
|
---|
83 | dprintf(0," CmdMod=%x ReqCtrl=%x Status=%x ErrorCode=%x\n",
|
---|
84 | pIorb->CommandModifier, pIorb->RequestControl, pIorb->Status, pIorb->ErrorCode);
|
---|
85 | dprintf(0," Timeout=%x StatusBlkLen=%x pStatusBlk=%x Res=%x f16NxtIORB=%x\n",
|
---|
86 | pIorb->Timeout, pIorb->StatusBlockLen, pIorb->pStatusBlock, pIorb->Reserved_1,
|
---|
87 | pIorb->f16NxtIORB);
|
---|
88 | }
|
---|
89 | #endif
|
---|
90 |
|
---|