summaryrefslogtreecommitdiff
path: root/radeon_pci.h
blob: 64aa89848df63a6551cabad8f140c0e24fd86063 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
 * Copyright © 2009 Jerome Glisse <glisse@freedesktop.org>
 *
 * This file is free software; you can redistribute it and/or modify
 * it under the terms of version 2 of the GNU General Public License
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 */
#ifndef RADEON_PCI_H
#define RADEON_PCI_H

#include <stdio.h>
#include <stdint.h>
#include <pciaccess.h>

#define PERR(fmt, args...) \
    fprintf(stderr, "EE %s:%d %s - "fmt, __FILE__, __LINE__, __func__, ##args)

struct radeon_pci {
    struct pci_device           *dev;
    unsigned char * volatile    mmio;
    pciaddr_t                   mmio_base;
    pciaddr_t                   mmio_size;
};

int radeon_pci_init(struct radeon_pci *pradeon);
void radeon_pci_fini(struct radeon_pci *pradeon);
uint32_t radeon_mmio_rd32(struct radeon_pci *pradeon, uint32_t offset);
void radeon_mmio_wr32(struct radeon_pci *pradeon, uint32_t offset, uint32_t value);

#endif