| 1 | /******************************************************************************
|
|---|
| 2 | * trace.c - code for our internal trace ring buffer
|
|---|
| 3 | *
|
|---|
| 4 | * Copyright (c) 2011 thi.guten Software Development
|
|---|
| 5 | * Copyright (c) 2011 Mensys B.V.
|
|---|
| 6 | * Copyright (c) 2013-2016 David Azarewicz
|
|---|
| 7 | *
|
|---|
| 8 | * Authors: Christian Mueller, Markus Thielen
|
|---|
| 9 | *
|
|---|
| 10 | * Parts copied from/inspired by the Linux AHCI driver;
|
|---|
| 11 | * those parts are (c) Linux AHCI/ATA maintainers
|
|---|
| 12 | *
|
|---|
| 13 | * This program is free software; you can redistribute it and/or modify
|
|---|
| 14 | * it under the terms of the GNU General Public License as published by
|
|---|
| 15 | * the Free Software Foundation; either version 2 of the License, or
|
|---|
| 16 | * (at your option) any later version.
|
|---|
| 17 | *
|
|---|
| 18 | * This program is distributed in the hope that it will be useful,
|
|---|
| 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 21 | * GNU General Public License for more details.
|
|---|
| 22 | *
|
|---|
| 23 | * You should have received a copy of the GNU General Public License
|
|---|
| 24 | * along with this program; if not, write to the Free Software
|
|---|
| 25 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|---|
| 26 | */
|
|---|
| 27 |
|
|---|
| 28 | #include "os2ahci.h"
|
|---|
| 29 |
|
|---|
| 30 | /* -------------------------- macros and constants ------------------------- */
|
|---|
| 31 |
|
|---|
| 32 | /* ------------------------ typedefs and structures ------------------------ */
|
|---|
| 33 |
|
|---|
| 34 | /* -------------------------- function prototypes -------------------------- */
|
|---|
| 35 |
|
|---|
| 36 | /* ------------------------ global/static variables ------------------------ */
|
|---|
| 37 |
|
|---|
| 38 | /* ----------------------------- start of code ----------------------------- */
|
|---|
| 39 |
|
|---|
| 40 | /******************************************************************************
|
|---|
| 41 | * Create adapter/port/device list for user output.
|
|---|
| 42 | */
|
|---|
| 43 | void build_user_info(void)
|
|---|
| 44 | {
|
|---|
| 45 | int a;
|
|---|
| 46 | int p;
|
|---|
| 47 | int d;
|
|---|
| 48 |
|
|---|
| 49 | for (a = 0; a < ad_info_cnt; a++)
|
|---|
| 50 | {
|
|---|
| 51 | AD_INFO *ai = ad_infos + a;
|
|---|
| 52 |
|
|---|
| 53 | dprintf(0,"Adapter %d: PCI=%d:%d:%d ID=%04x:%04x %s %s irq=%d addr=0x%x version=%x\n", a,
|
|---|
| 54 | PCI_BUS_FROM_BDF(ai->bus_dev_func), PCI_DEV_FROM_BDF(ai->bus_dev_func),
|
|---|
| 55 | PCI_FUNC_FROM_BDF(ai->bus_dev_func),
|
|---|
| 56 | ai->pci_vendor, ai->pci_device, vendor_from_id(ai->pci_vendor), ai->pci->chipname,
|
|---|
| 57 | ai->irq, ai->mmio_phys,
|
|---|
| 58 | ai->bios_config[HOST_VERSION / sizeof(u32)]);
|
|---|
| 59 |
|
|---|
| 60 | for (p = 0; p < ai->hw_ports; p++)
|
|---|
| 61 | {
|
|---|
| 62 | P_INFO *pi = &ai->ports[p];
|
|---|
| 63 |
|
|---|
| 64 | dprintf(0," Port %d:\n", p);
|
|---|
| 65 |
|
|---|
| 66 | for (d = 0; d <= pi->dev_max; d++)
|
|---|
| 67 | {
|
|---|
| 68 | if (!pi->devs[d].present)
|
|---|
| 69 | {
|
|---|
| 70 | dprintf(0," No drive present\n");
|
|---|
| 71 | } else {
|
|---|
| 72 | dprintf(0," Drive %d:", d);
|
|---|
| 73 | if (pi->devs[d].atapi) dprintf(0," atapi");
|
|---|
| 74 | if (pi->devs[d].removable) dprintf(0," removable");
|
|---|
| 75 | if (pi->devs[d].dev_info.Method != NULL)
|
|---|
| 76 | {
|
|---|
| 77 | dprintf(0," %d cylinders, %d heads, %d sectors per track (%dMB) (%s)",
|
|---|
| 78 | pi->devs[d].dev_info.Cylinders, pi->devs[d].dev_info.HeadsPerCylinder, pi->devs[d].dev_info.SectorsPerTrack,
|
|---|
| 79 | pi->devs[d].dev_info.TotalSectors/2048, pi->devs[d].dev_info.Method);
|
|---|
| 80 | }
|
|---|
| 81 | dprintf(0,"\n");
|
|---|
| 82 | } /* if */
|
|---|
| 83 | } /* for d */
|
|---|
| 84 | } /* for p */
|
|---|
| 85 | } /* for a */
|
|---|
| 86 | }
|
|---|
| 87 |
|
|---|
| 88 | #ifdef DEBUG
|
|---|
| 89 | void DumpIorb(IORBH *pIorb)
|
|---|
| 90 | {
|
|---|
| 91 | DPRINTF(2,"IORB %x: Size=%x Len=%x Handle=%x CmdCode=%x\n",
|
|---|
| 92 | pIorb, sizeof(IORBH), pIorb->Length, pIorb->UnitHandle, pIorb->CommandCode);
|
|---|
| 93 | DPRINTF(2," CmdMod=%x ReqCtrl=%x Status=%x ErrorCode=%x\n",
|
|---|
| 94 | pIorb->CommandModifier, pIorb->RequestControl, pIorb->Status, pIorb->ErrorCode);
|
|---|
| 95 | DPRINTF(2," Timeout=%x StatusBlkLen=%x pStatusBlk=%x Res=%x pNxtIORB=%x\n",
|
|---|
| 96 | pIorb->Timeout, pIorb->StatusBlockLen, pIorb->pStatusBlock, pIorb->Reserved_1,
|
|---|
| 97 | pIorb->pNxtIORB);
|
|---|
| 98 | }
|
|---|
| 99 | #endif
|
|---|
| 100 |
|
|---|