1/*
2 * Copyright 2006-2009, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *		Axel D��rfler, axeld@pinc-software.de
7 */
8#ifndef DRIVER_H
9#define DRIVER_H
10
11
12#include <KernelExport.h>
13#include <PCI.h>
14
15
16#include <kernel/lock.h>
17
18
19#include "radeon_hd.h"
20#include "radeon_hd_private.h"
21
22
23// PCI Communications
24
25#define read8(address)   		(*((volatile uint8*)(address)))
26#define read16(address)  		(*((volatile uint16*)(address)))
27#define read32(address) 		(*((volatile uint32*)(address)))
28#define write8(address, data)  	(*((volatile uint8*)(address)) = (data))
29#define write16(address, data) 	(*((volatile uint16*)(address)) = (data))
30#define write32(address, data) 	(*((volatile uint32*)(address)) = (data))
31
32
33extern char* gDeviceNames[];
34extern radeon_info* gDeviceInfo[];
35extern pci_module_info* gPCI;
36extern mutex gLock;
37
38
39static inline uint32
40get_pci_config(pci_info* info, uint8 offset, uint8 size)
41{
42	return gPCI->read_pci_config(info->bus, info->device, info->function,
43		offset, size);
44}
45
46
47static inline void
48set_pci_config(pci_info* info, uint8 offset, uint8 size, uint32 value)
49{
50	gPCI->write_pci_config(info->bus, info->device, info->function, offset,
51		size, value);
52}
53
54
55#endif  /* DRIVER_H */
56
57