Changeset 80 for trunk/src/os2ahci/pci.c
- Timestamp:
- Mar 1, 2011, 10:10:11 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/os2ahci/pci.c
r79 r80 183 183 * other strings 184 184 */ 185 static char s_already_claimed[] = "Warning: device already claimed by other driver.\n";185 static char s_already_claimed[] = "Warning: device already claimed by another driver.\n"; 186 186 187 187 … … 684 684 * the MMIO base address register (BAR), read back the resulting value 685 685 * and check the 0 bits from the right end. After doing this, we must 686 * restore the original value set up by the BIOS because we're not yet 687 * ready to take over. 686 * restore the original value set up by the BIOS. 688 687 * 689 688 * The least significant 4 bits are not relevant for the MMIO address, thus … … 713 712 mmio_size <<= 1); 714 713 715 ddprintf("MMIO size 716 ddprintf("MMIO address (BIOS)= 0x%08lx\n", mmio_bios & 0xfffffff0UL);714 ddprintf("MMIO size = %ld\n", mmio_size); 715 ddprintf("MMIO address = 0x%08lx\n", mmio_bios & 0xfffffff0UL); 717 716 718 717 /* register BIOS MMIO address space with resource manager */ … … 724 723 725 724 ret = RMAllocResource(rm_drvh, &ad_info->rm_mmio, &resource); 726 727 725 if (ret != RMRC_SUCCESS) { 728 726 if (ret == RMRC_RES_ALREADY_CLAIMED) { 729 /* MT: according to my observations, this is the 2nd place730 * where we could fail due to the adapter having been already731 * claimed by another driver...732 */733 727 cprintf(s_already_claimed); 734 return; 728 } else { 729 cprintf("error: couldn't register MMIO region (rc = %d)\n", ret); 735 730 } 736 /* didn't work; try to find another MMIO region */737 cprintf("warning: BIOS MMIO address not accepted by resource manager "738 "(code %d)\n", ret);739 memset(&resource, 0x00, sizeof(resource));740 resource.ResourceType = RS_TYPE_MEM;741 resource.MEMResource.MemSize = mmio_size;742 resource.MEMResource.MemFlags = RS_MEM_EXCLUSIVE | RS_SEARCH;743 744 ret = RMAllocResource(rm_drvh, &ad_info->rm_mmio, &resource);745 746 if (ret == RMRC_SUCCESS) {747 /* MT: got a new address from Resource Manager; now we748 * need to tell PCI about the new address.749 * Leave the last 4 bits of the original MMIO value alone.750 */751 mmio_bios = (mmio_bios & 0x0000000fUL) |752 (resource.MEMResource.MemBase & 0xfffffff0UL);753 ddprintf("address we got from RM: 0x%08lx\n",754 resource.MEMResource.MemBase);755 ddprintf("setting new MMIO addr to 0x%08lx\n", mmio_bios);756 757 if (pci_write_conf(bus, dev_func, AHCI_MMIO,758 sizeof(u32), mmio_bios) != OH_SUCCESS) {759 /* failed to update MMIO address - bail out */760 cprintf("error: couldn't update MMIO address\n");761 ret = ~RMRC_SUCCESS;762 return;763 }764 }765 }766 767 if (ret != RMRC_SUCCESS) {768 cprintf("error: couldn't register MMIO region (rc = %d)\n", ret);769 731 return; 770 732 } 771 733 rc_list->hResource[rc_list->NumResource++] = ad_info->rm_mmio; 772 ddprintf("MMIO address (final) = 0x%08lx\n", resource.MEMResource.MemBase);773 734 774 735 /****************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.