xref: /haiku/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.h (revision 9760dcae2038d47442f4658c2575844c6cf92c40)
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 #include <kernel/lock.h>
16 
17 #include "intel_extreme_private.h"
18 
19 
20 // PCI Communications
21 
22 #define read8(address)   		(*((volatile uint8*)(address)))
23 #define read16(address)  		(*((volatile uint16*)(address)))
24 #define read32(address) 		(*((volatile uint32*)(address)))
25 #define write8(address, data)  	(*((volatile uint8*)(address)) = (data))
26 #define write16(address, data) 	(*((volatile uint16*)(address)) = (data))
27 #define write32(address, data) 	(*((volatile uint32*)(address)) = (data))
28 
29 
30 extern char* gDeviceNames[];
31 extern intel_info* gDeviceInfo[];
32 extern pci_module_info* gPCI;
33 extern agp_gart_module_info* gGART;
34 extern mutex gLock;
35 
36 
37 static inline uint32
38 get_pci_config(pci_info* info, uint8 offset, uint8 size)
39 {
40 	return gPCI->read_pci_config(info->bus, info->device, info->function,
41 		offset, size);
42 }
43 
44 
45 static inline void
46 set_pci_config(pci_info* info, uint8 offset, uint8 size, uint32 value)
47 {
48 	gPCI->write_pci_config(info->bus, info->device, info->function, offset,
49 		size, value);
50 }
51 
52 #endif  /* DRIVER_H */
53