Ticket #5872: nvidia_driver_syslog.patch

File nvidia_driver_syslog.patch, 6.4 KB (added by Ziusudra, 14 years ago)

added syslogs for error conditions to driver - added no device syslog to init_hardware()

  • src/add-ons/kernel/drivers/graphics/nvidia/driver.c

     
    265265    0x02a0, /* Nvidia GeForce3 Integrated GPU */
    266266    0x02e0, /* Nvidia GeForce 7600 GT */
    267267    0x02e1, /* Nvidia GeForce 7600 GS */
     268    0x02e2, /* Nvidia GeForce 7300 GT */
    268269    0x0301, /* Nvidia GeForce FX 5800 Ultra */
    269270    0x0302, /* Nvidia GeForce FX 5800 */
    270271    0x0308, /* Nvidia Quadro FX 2000 */
     
    395396    uint32 cnt;
    396397    char fname[64];
    397398
     399    dprintf(DRIVER_PREFIX ": ROM dump requested\n");
    398400    /* determine the romfile name: we need split-up per card in the system */
    399401    sprintf (fname, "/boot/home/" DRIVER_PREFIX "." DEVICE_FORMAT ".rom",
    400402        pcii.vendor_id, pcii.device_id, pcii.bus, pcii.device, pcii.function);
     
    407409    for (cnt = 0; (cnt < size); cnt += 32768)
    408410        write (fd, ((void *)(((uint8 *)rom) + cnt)), 32768);
    409411    close (fd);
     412    dprintf(DRIVER_PREFIX ": ROM dump successful\n");
    410413}
    411414
    412415
     
    605608        /* check if we got the BIOS and signature (might fail on laptops..) */
    606609        if (rom_area >= 0) {
    607610            if ((rom_temp[0] != 0x55) || (rom_temp[1] != 0xaa)) {
     611                dprintf(DRIVER_PREFIX ": PCI mismapped ROM\n");
    608612                /* apparantly no ROM is mapped here */
    609613                delete_area(rom_area);
    610614                rom_area = -1;
     
    612616                tmpUlong = 0x00000000;
    613617            }
    614618        } else {
     619            dprintf(DRIVER_PREFIX ": PCI map ROM failed\n");
    615620            /* mapping failed: force using ISA legacy map as fall-back */
    616621            tmpUlong = 0x00000000;
    617622        }
    618623    }
    619624
    620625    if (!tmpUlong) {
     626        dprintf(DRIVER_PREFIX ": trying ISA map ROM for %s\n", di->name);
    621627        /* ROM was not assigned an adress, fetch it from ISA legacy memory map! */
    622628        rom_area = map_physical_memory(buffer, (void *)0x000c0000,
    623629            65536, B_ANY_KERNEL_ADDRESS, B_READ_AREA, (void **)&(rom_temp));
     
    625631
    626632    /* if mapping ROM to vmem failed then clean up and pass on error */
    627633    if (rom_area < 0) {
     634        dprintf(DRIVER_PREFIX ": ISA map ROM failed\n");
    628635        delete_area(si->regs_area);
    629636        si->regs_area = -1;
    630637        return rom_area;
     
    663670
    664671    /*if failed with write combining try again without*/
    665672    if (si->fb_area < 0) {
     673        dprintf(DRIVER_PREFIX ": trying frame buffer without Write Combining"
     674            "for %s\n", di->name);
    666675        si->fb_area = map_physical_memory(buffer,
    667676            /* WARNING: Nvidia needs to map framebuffer as viewed from PCI space! */
    668677            (void *) di->pcii.u.h0.base_registers_pci[frame_buffer],
     
    674683
    675684    /* if there was an error, delete our other areas and pass on error*/
    676685    if (si->fb_area < 0) {
     686        dprintf(DRIVER_PREFIX ": failed to create frame buffer for %s\n",
     687            di->name);
    677688        delete_area(si->regs_area);
    678689        si->regs_area = -1;
    679690        return si->fb_area;
     
    778789    pd->count = count;
    779790    /* terminate list of device names with a null pointer */
    780791    pd->device_names[pd->count] = NULL;
     792    if (count == 1) dprintf(DRIVER_PREFIX ": 1 device found\n");
     793    else dprintf(DRIVER_PREFIX ": %d devices found\n", count);
    781794}
    782795
    783796
     
    885898        ((sizeof(shared_info) + (B_PAGE_SIZE - 1)) & ~(B_PAGE_SIZE - 1)), B_FULL_LOCK,
    886899        B_USER_CLONEABLE_AREA);
    887900    if (di->shared_area < 0) {
     901        dprintf(DRIVER_PREFIX ": failed to create shared info area for %s\n",
     902            name);
    888903        /* return the error */
    889904        result = di->shared_area;
    890905        goto done;
     
    908923    /* on error, abort */
    909924    if (si->unaligned_dma_area < 0)
    910925    {
     926        dprintf(DRIVER_PREFIX ": failed to create DMA cmd buffer for %s\n",
     927            name);
    911928        /* free the already created shared_info area, and return the error */
    912929        result = si->unaligned_dma_area;
    913930        goto free_shared;
     
    926943        B_READ_AREA | B_WRITE_AREA, &(si->dma_buffer));
    927944    /* if failed with write combining try again without */
    928945    if (si->dma_area < 0) {
     946        dprintf(DRIVER_PREFIX ": trying DMA cmd buffer without Write Combining"
     947            "for %s\n", name);
    929948        si->dma_area = map_physical_memory(
    930949            "NV aligned DMA cmd buffer", si->dma_buffer_pci, net_buf_size,
    931950            B_ANY_KERNEL_BLOCK_ADDRESS,
     
    934953    /* if there was an error, delete our other areas and pass on error*/
    935954    if (si->dma_area < 0)
    936955    {
     956        dprintf(DRIVER_PREFIX ": failed to map DMA cmd buffer for %s\n", name);
    937957        /* free the already created areas, and return the error */
    938958        result = si->dma_area;
    939959        goto free_shared_and_uadma;
     
    9981018
    9991019    /* create a semaphore for vertical blank management */
    10001020    si->vblank = create_sem(0, di->name);
    1001     if (si->vblank < 0) goto mark_as_open;
     1021    if (si->vblank < 0)
     1022    {
     1023        dprintf(DRIVER_PREFIX ": failed to create semaphore for %s\n", name);
     1024        goto mark_as_open;
     1025    }
    10021026
    10031027    /* change the owner of the semaphores to the opener's team */
    10041028    /* this is required because apps can't aquire kernel semaphores */
     
    10341058    }
    10351059
    10361060mark_as_open:
     1061    dprintf(DRIVER_PREFIX ": opened hook for %s\n", name);
    10371062    /* mark the device open */
    10381063    di->is_open++;
    10391064
     
    10441069
    10451070
    10461071free_shared_and_alldma:
     1072    dprintf(DRIVER_PREFIX ": failed to map device\n");
    10471073    /* clean up our aligned DMA area */
    10481074    delete_area(si->dma_area);
    10491075    si->dma_area = -1;
     
    11621188        /* the only PUBLIC ioctl */
    11631189        case B_GET_ACCELERANT_SIGNATURE:
    11641190        {
     1191            dprintf(DRIVER_PREFIX ": %s\n", sSettings.accelerant);
    11651192            strcpy((char* )buf, sSettings.accelerant);
    11661193            result = B_OK;
    11671194            break;
     
    13471374
    13481375    /* choke if we can't find the PCI bus */
    13491376    if (get_module(B_PCI_MODULE_NAME, (module_info **)&pci_bus) != B_OK)
     1377    {
     1378        dprintf(DRIVER_PREFIX ": failed to get PCI bus!\n");
    13501379        return B_ERROR;
     1380    }
    13511381
    13521382    /* choke if we can't find the ISA bus */
    13531383    if (get_module(B_ISA_MODULE_NAME, (module_info **)&isa_bus) != B_OK)
    13541384    {
     1385        dprintf(DRIVER_PREFIX ": failed to get ISA bus!\n");
    13551386        put_module(B_PCI_MODULE_NAME);
    13561387        return B_ERROR;
    13571388    }
     
    13831414    }
    13841415
    13851416done:
     1417    if (!found) dprintf(DRIVER_PREFIX ": no supported device found\n");
    13861418    /* put away the module manager */
    13871419    put_module(B_PCI_MODULE_NAME);
    13881420    return found ? B_OK : B_ERROR;
     
    14011433        char *end;
    14021434        uint32 value;
    14031435
     1436        dprintf(DRIVER_PREFIX ": settings loaded\n");
     1437
    14041438        // for driver
    14051439        item = get_driver_parameter(settings, "accelerant", "", "");
    14061440        if (item[0] && strlen(item) < sizeof(sSettings.accelerant) - 1)
     
    14641498            sSettings.ram_clk = value;
    14651499
    14661500        unload_driver_settings(settings);
    1467     }
     1501    } else dprintf(DRIVER_PREFIX ": using default settings\n");
    14681502
    14691503    /* get a handle for the pci bus */
    14701504    if (get_module(B_PCI_MODULE_NAME, (module_info **)&pci_bus) != B_OK)