Changeset 171 for trunk


Ignore:
Timestamp:
Sep 7, 2013, 5:52:45 PM (12 years ago)
Author:
David Azarewicz
Message:

Enhanced debug output
Fixed a long time PCI ID bug.

Location:
trunk/src/os2ahci
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/os2ahci/Makefile

    r169 r171  
    153153    @AddToFile $^@,$#define BLD_MONTH,DATEMONTH
    154154    @AddToFile $^@,$#define BLD_DAY,DATEDAY
    155     @AddToFile $^@,$#define BLDLEVEL,BLDLEVEL2,$(VENDOR),$(BLD_MAJOR).$(BLD_MINOR),AHCI Driver (c) Mensys BV 2013,$(FIXPACK)
     155    @AddToFile $^@,$#define BLDLEVEL,BLDLEVEL2,$(VENDOR),$(BLD_MAJOR).$(BLD_MINOR),AHCI Driver (c) 2013 $(VENDOR),$(FIXPACK)
    156156
    157157.asm.obj: .autodepend
  • trunk/src/os2ahci/README

    r169 r171  
    1717Copyright (c) 2011 thi.guten Software Development
    1818Copyright (c) 2011-2013 Mensys B.V.
    19 Portions copyright (c) 2013 David Azarewicz
     19Copyright (c) 2013 David Azarewicz
    2020
    2121Authors: Christian Mueller, Markus Thielen
     
    394394==========
    395395
    396 v.1.31 04-Aug-2013 - David Azarewicz
     396v.1.31 21-Aug-2013 - David Azarewicz
    397397  Enhanced debug output.
    398398  Added code to check for bad geometries reported by the BIOS and fix them.
     399  Fixed a PCI ID coding error that has been there since version 1.01.
    399400
    400401v.1.30 29-Jun-2013 - David Azarewicz
  • trunk/src/os2ahci/ahci.c

    r169 r171  
    44 * Copyright (c) 2011 thi.guten Software Development
    55 * Copyright (c) 2011 Mensys B.V.
    6  * Portions copyright (c) 2013 David Azarewicz
     6 * Copyright (c) 2013 David Azarewicz
    77 *
    88 * Authors: Christian Mueller, Markus Thielen
     
    234234  }
    235235
    236 #if 0
    237   /* init_reset is set by default. This code is commented out to allow
    238    * unsetting init_reset by a command line switch
    239    */
    240236  if ((ai->bios_config[HOST_CTL / sizeof(u32)] & HOST_AHCI_EN) == 0 &&
    241       ai->pci->vendor == PCI_VENDOR_ID_INTEL) {
     237      ai->pci_vendor == PCI_VENDOR_ID_INTEL) {
    242238    /* Adapter is not in AHCI mode and the spec says a COMRESET is
    243239     * required when switching from SATA to AHCI mode and vice versa.
     
    245241    init_reset = 1;
    246242  }
    247 #endif
    248243
    249244  #ifdef DEBUG
     
    295290  }
    296291
    297   if (ai->pci->vendor == PCI_VENDOR_ID_JMICRON &&
    298       ai->pci->device == 0x2361 && ai->port_map != 1) {
     292  if (ai->pci_vendor == PCI_VENDOR_ID_JMICRON &&
     293      ai->pci_device == 0x2361 && ai->port_map != 1) {
    299294    dprintf("JMB361 has only one port, port_map 0x%lx -> 0x%lx\n", ai->port_map, 1);
    300295    ai->port_map = 1;
     
    353348
    354349  if ((ai->bios_config[HOST_CTL / sizeof(u32)] & HOST_AHCI_EN) == 0 &&
    355       ai->pci->vendor == PCI_VENDOR_ID_INTEL) {
     350      ai->pci_vendor == PCI_VENDOR_ID_INTEL) {
    356351
    357352    /* This BIOS apparently accesses the controller via SATA registers and
     
    455450    ahci_restore_initial_config(ai);
    456451
    457     if (ai->pci->vendor == PCI_VENDOR_ID_INTEL) {
     452    if (ai->pci_vendor == PCI_VENDOR_ID_INTEL) {
    458453      u32 tmp16 = 0;
    459454
     
    12431238    }
    12441239
     1240    /* 0x89 = BSY(0x80) | DRQ(0x08) | ERR(0x01) */
    12451241    if (rc) {
    12461242      dprintf(" timeout for IORB %Fp", iorb);
    12471243      iorb_seterr(iorb, IOERR_ADAPTER_TIMEOUT);
    1248     } else if (readl(port_mmio + PORT_SCR_ERR) != 0 ||
    1249                readl(port_mmio + PORT_TFDATA) & 0x89) {
     1244    } else if (readl(port_mmio + PORT_SCR_ERR) != 0 || readl(port_mmio + PORT_TFDATA) & 0x89) {
    12501245      dprintf(" polled cmd error for IORB %Fp", iorb);
    12511246      iorb_seterr(iorb, IOERR_DEVICE_NONSPECIFIC);
     
    13131308  while (readl(port_mmio + PORT_CMD_ISSUE) & 1) {
    13141309    rc = timer_check_and_block(&Timer);
    1315     if (rc) break;
    1316   }
    1317 
    1318   /* check error condition */
     1310    if (rc) {
     1311      dprintf(" Timeout", tmp);
     1312      break;
     1313    }
     1314  }
     1315
    13191316  if ((tmp = readl(port_mmio + PORT_SCR_ERR)) != 0) {
    13201317    dprintf(" SERR = 0x%08lx", tmp);
    13211318    rc = 1;
    13221319  }
     1320  /* 0x89 = BSY(0x80) | DRQ(0x08) | ERR(0x01) */
    13231321  if (((tmp = readl(port_mmio + PORT_TFDATA)) & 0x89) != 0) {
    13241322    dprintf(" TFDATA = 0x%08lx", tmp);
     
    18191817
    18201818  /* try to detect virtualbox environment to enable a hack for IRQ routing */
    1821   if (ai == ad_infos && ai->pci->vendor == 0x8086 && ai->pci->device == 0x2829 &&
     1819  if (ai == ad_infos && ai->pci_vendor == 0x8086 && ai->pci_device == 0x2829 &&
    18221820      !memcmp(ata_dev_name(id_buf), "VBOX HARDDISK", 13)) {
    18231821    /* running inside virtualbox */
  • trunk/src/os2ahci/init.asm

    r165 r171  
    3737DEVHDR          SEGMENT WORD PUBLIC 'DATA'
    3838_dev_hdr        dd      -1                      ; next device header
    39                 dw      DEVLEV_3 + DEV_CHAR_DEV + DEV_IDC ; flags for ADD drivers
     39                dw      DEVLEV_3 + DEV_CHAR_DEV + DEV_IDC + DEV_30; flags for ADD drivers
    4040                dw      OFFSET _asm_strat       ; strategy routine
    4141                dw      OFFSET _asm_idc_entry   ; IDC entry point
  • trunk/src/os2ahci/os2ahci.c

    r170 r171  
    44 * Copyright (c) 2011 thi.guten Software Development
    55 * Copyright (c) 2011 Mensys B.V.
    6  * Portions copyright (c) 2013 David Azarewicz
     6 * Copyright (c) 2013 David Azarewicz
    77 *
    88 * Authors: Christian Mueller, Markus Thielen
     
    153153
    154154/******************************************************************************
    155  * OS/2 device driver main strategy function. This function is only used
    156  * for initialization purposes; all other calls go directly to the adapter
    157  * device driver's strategy function.
     155 * OS/2 device driver main strategy function.
    158156 *
    159157 * NOTE: this is also used as the IDC entry point. We expect an IOCTL request
     
    178176    break;
    179177
     178  case CMDOpen:
     179    build_user_info(1);
     180    rc = STDON;
     181    break;
     182
    180183  case CMDINPUT:
    181184    rc = char_dev_input((RP_RWV _far *) req);
     
    184187  case CMDSaveRestore:
    185188    rc = sr_drv(((RPSAVERESTORE _far *) req)->FuncCode);
     189    break;
     190
     191  case CMDClose:
     192  case CMDInputS:
     193  case CMDInputF:
     194    /* noop */
     195    rc = STDON;
    186196    break;
    187197
     
    831841      #endif
    832842
    833       build_user_info();
     843      build_user_info(0);
    834844    }
    835845    iorb_done(iorb);
  • trunk/src/os2ahci/os2ahci.h

    r170 r171  
    44 * Copyright (c) 2011 thi.guten Software Development
    55 * Copyright (c) 2011 Mensys B.V.
     6 * Copyright (c) 2013 David Azarewicz
    67 *
    78 * Authors: Christian Mueller, Markus Thielen
     
    376377
    377378  u32           port_map;              /* bitmap of active ports */
     379  u16           pci_vendor;
     380  u16           pci_device;
    378381
    379382  /* initial adapter configuration from BIOS */
     
    572575extern u16         trace_read    (u8 _far *buf, u16 cb_buf);
    573576extern u16         trace_char_dev(RP_RWV _far *rwrb);
    574 extern void        build_user_info(void);
     577extern void        build_user_info(int check);
    575578
    576579/* pci.c */
  • trunk/src/os2ahci/pci.c

    r167 r171  
    44 * Copyright (c) 2011 thi.guten Software Development
    55 * Copyright (c) 2011 Mensys B.V.
     6 * Copyright (c) 2013 David Azarewicz
    67 *
    78 * Authors: Christian Mueller, Markus Thielen
     
    712713   * itself with the OS/2 resource manager
    713714   */
    714   ad_info->pci      = pci_ids + i;
    715   ad_info->bus      = bus;
     715  ad_info->pci = pci_id;
     716  ad_info->pci_vendor = vendor;
     717  ad_info->pci_device = device;
     718  ad_info->bus = bus;
    716719  ad_info->dev_func = dev_func;
    717   ad_info->irq      = irq;
     720  ad_info->irq = irq;
    718721
    719722  /* allocate memory for port-specific DMA scratch buffers */
  • trunk/src/os2ahci/trace.c

    r170 r171  
    44 * Copyright (c) 2011 thi.guten Software Development
    55 * Copyright (c) 2011 Mensys B.V.
    6  * Portions copyright (c) 2013 David Azarewicz
     6 * Copyright (c) 2013 David Azarewicz
    77 *
    88 * Authors: Christian Mueller, Markus Thielen
     
    210210 * Create adapter/port/device list for user output.
    211211 */
    212 void build_user_info(void)
     212void build_user_info(int check)
    213213{
    214214  int a;
     
    216216  int d;
    217217
     218  if ( check && (ahci_trace_buf.readp != ahci_trace_buf.writep)) return;
     219
    218220  for (a = 0; a < ad_info_cnt; a++) {
    219221    AD_INFO *ai = ad_infos + a;
    220222
    221     ntprintf("Adapter %d: PCI=%d:%d:%d ID=%04x:%04x irq=%d addr=0x%lx version=%lx\n", a,
     223    ntprintf("Adapter %d: PCI=%d:%d:%d ID=%04x:%04x %s %s irq=%d addr=0x%lx version=%lx\n", a,
    222224      ai->bus, ai->dev_func>>3, ai->dev_func&7,
    223       ai->pci->vendor, ai->pci->device,
     225      ai->pci_vendor, ai->pci_device, vendor_from_id(ai->pci_vendor), ai->pci->chipname,
    224226      ai->irq, ai->mmio_phys,
    225227      ai->bios_config[HOST_VERSION / sizeof(u32)]);
Note: See TracChangeset for help on using the changeset viewer.