[lkml]   [2003]   [Aug]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectStandard driver call to enable/disable PCI ROM
    I needed to enable a PCI ROM and read a few things
    from it, and then disable it again. It might be worth
    adding a standard PCI API in 2.6 for this.

    Here's the code I used...

    static void * __init aty128_map_ROM(struct pci_dev
    *dev, const struct aty128fb_par
    void *rom;
    struct resource *r =

    /* assign address if it doesn't have one */
    if (r->start == 0)

    /* enable if needed */
    if (!(r->flags & PCI_ROM_ADDRESS_ENABLE)) {
    dev->rom_base_reg, r->start |
    r->flags |= PCI_ROM_ADDRESS_ENABLE;
    rom = ioremap(r->start, r->end - r->start + 1);
    if (!rom) {
    printk(KERN_ERR "aty128fb: ROM failed to map\n");
    return NULL;
    /* Very simple test to make sure it appeared */
    if (readb(rom) != 0x55) {
    printk(KERN_ERR "aty128fb: Invalid ROM
    signature %x should be 0x55\n",
    aty128_unmap_ROM(dev, rom);
    return NULL;
    return rom;

    static void __init aty128_unmap_ROM(struct pci_dev
    void * rom)
    /* leave it disabled and unassigned */
    struct resource *r =


    r->flags &= ~PCI_ROM_ADDRESS_ENABLE;
    r->end -= r->start;
    r->start = 0;
    /* This will disable and set address to unassigned
    pci_write_config_dword(dev, dev->rom_base_reg, 0);

    Jon Smirl

    Do you Yahoo!?
    Yahoo! SiteBuilder - Free, easy-to-use web site design software
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 13:47    [W:0.021 / U:6.904 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site