xref: /haiku/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.h (revision 1e36cfc2721ef13a187c6f7354dc9cbc485e89d3)
1 /*
2  * Copyright 2006, 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 struct lock gLock;
32 
33 
34 static inline uint32
35 get_pci_config(pci_info *info, uint8 offset, uint8 size)
36 {
37 	return gPCI->read_pci_config(info->bus, info->device, info->function, offset, size);
38 }
39 
40 
41 static inline void
42 set_pci_config(pci_info *info, uint8 offset, uint8 size, uint32 value)
43 {
44 	gPCI->write_pci_config(info->bus, info->device, info->function, offset, size, value);
45 }
46 
47 #endif  /* DRIVER_H */
48