Changeset 48 for trunk


Ignore:
Timestamp:
Dec 2, 2010, 1:12:53 PM (15 years ago)
Author:
markus
Message:

display console message if AHCI device is claimed by other driver; fixed crash during init cleanup (if adapter init fails)

Location:
trunk/src/os2ahci
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/os2ahci/os2ahci.def

    r45 r48  
    11library os2ahci
    2 Description '$@#thi.guten (www.thiguten.de):1.00.20101201#@OS/2 AHCI Adapter Device Driver'
     2Description '$@#thi.guten (www.thiguten.de):1.00.20101202#@OS/2 AHCI Adapter Device Driver'
    33protmode
    44
  • trunk/src/os2ahci/pci.c

    r42 r48  
    179179
    180180static char s_generic[]       = "Generic";
     181
     182/******************************************************************************
     183 * other strings
     184 */
     185static char s_already_claimed[] = "Warning: device already claimed by other driver.\n";
    181186
    182187
     
    641646    case RMRC_DEV_ALREADY_CLAIMED:
    642647    case RMRC_RES_ALREADY_CLAIMED:
    643       cprintf("warning: device already claimed by other driver\n");
     648      cprintf(s_already_claimed);
    644649      return;
    645650    default:
     
    677682      pci_write_conf(bus, dev_func, AHCI_MMIO, sizeof(u32), mmio_bios);
    678683    }
    679     goto add_pci_fail;
     684    return;
    680685  }
    681686  for (mmio_size = 0x00000010UL;
     
    696701
    697702  if (ret != RMRC_SUCCESS) {
     703    if (ret == RMRC_RES_ALREADY_CLAIMED) {
     704      /* MT: according to my observations, this is the 2nd place
     705       * where we could fail due to the adapter having been already
     706       * claimed by another driver...
     707       */
     708      cprintf(s_already_claimed);
     709      return;
     710    }
    698711    /* didn't work; try to find another MMIO region */
    699     cprintf("warning: BIOS MMIO address not accepted by resource manager\n");
     712    cprintf("warning: BIOS MMIO address not accepted by resource manager "
     713            "(code %d)\n", ret);
    700714    memset(&resource, 0x00, sizeof(resource));
    701715    resource.ResourceType         = RS_TYPE_MEM;
    702716    resource.MEMResource.MemSize  = mmio_size;
    703717    resource.MEMResource.MemFlags = RS_MEM_EXCLUSIVE | RS_SEARCH;
    704 
     718   
    705719    ret = RMAllocResource(rm_drvh, &ad_info->rm_mmio, &resource);
    706 
     720   
    707721    if (ret == RMRC_SUCCESS) {
    708722      /* MT: got a new address from Resource Manager; now we
     
    711725       */
    712726      mmio_bios = (mmio_bios & 0x0000000fUL) |
    713         (resource.MEMResource.MemBase & 0xfffffff0UL);
     727        (resource.MEMResource.MemBase & 0xfffffff0UL);
    714728      ddprintf("address we got from RM: 0x%08lx\n",
    715729               resource.MEMResource.MemBase);
    716730      ddprintf("setting new MMIO addr to 0x%08lx\n", mmio_bios);
    717 
     731     
    718732      if (pci_write_conf(bus, dev_func, AHCI_MMIO,
    719                         sizeof(u32), mmio_bios) != OH_SUCCESS) {
     733                        sizeof(u32), mmio_bios) != OH_SUCCESS) {
    720734        /* failed to update MMIO address - bail out */
    721         cprintf("error: couldn't update MMIO address\n");
    722         ret = ~RMRC_SUCCESS;
    723         goto add_pci_fail;
     735        cprintf("error: couldn't update MMIO address\n");
     736        ret = ~RMRC_SUCCESS;
     737        return;
    724738      }
    725 
    726739    }
    727740  }
     
    729742  if (ret != RMRC_SUCCESS) {
    730743    cprintf("error: couldn't register MMIO region (rc = %d)\n", ret);
    731     goto add_pci_fail;
     744    return;
    732745  }
    733746  rc_list->hResource[rc_list->NumResource++] = ad_info->rm_mmio;
Note: See TracChangeset for help on using the changeset viewer.