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