xref: /haiku/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme_private.h (revision 4bd0c1066b227cec4b79883bdef697c7a27f2e90)
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 INTEL_EXTREME_PRIVATE_H
9 #define INTEL_EXTREME_PRIVATE_H
10 
11 
12 #include <AGP.h>
13 #include <KernelExport.h>
14 #include <PCI.h>
15 #include <PCI_x86.h>
16 
17 #include "intel_extreme.h"
18 #include "lock.h"
19 
20 
21 struct intel_info {
22 	int32			open_count;
23 	status_t		init_status;
24 	int32			id;
25 	pci_info*		pci;
26 	addr_t			aperture_base;
27 	aperture_id		aperture;
28 
29 	addr_t			registers;
30 
31 	area_id			registers_area;
32 	struct intel_shared_info* shared_info;
33 	area_id			shared_area;
34 
35 	struct overlay_registers* overlay_registers;
36 
37 	bool			fake_interrupts;
38 	uint8			irq;
39 	bool			use_msi;
40 
41 	const char*		device_identifier;
42 	DeviceType		device_type;
43 
44 	enum pch_info	pch_info;
45 };
46 
47 
48 static inline uint32
49 find_reg(const intel_info& info, uint32 target)
50 {
51 	if (REGISTER_BLOCK(target) != REGS_FLAT) {
52 		panic("find_reg is only supposed to be used for unrouped registers\n");
53 		return target;
54 	}
55 
56 	if (info.pch_info == INTEL_PCH_NONE)
57 		return target;
58 
59 	#define RETURN_REG(x)	case INTEL_##x: return PCH_##x;
60 
61 	switch (target) {
62 		RETURN_REG(INTERRUPT_ENABLED)
63 		RETURN_REG(INTERRUPT_IDENTITY)
64 		RETURN_REG(INTERRUPT_MASK)
65 		RETURN_REG(INTERRUPT_STATUS)
66 	}
67 
68 	#undef RETURN_REG
69 
70 	panic("find_reg didn't have any matching register\n");
71 	return target;
72 }
73 
74 
75 extern bool get_lvds_mode_from_bios(display_mode *mode);
76 extern status_t intel_free_memory(intel_info& info, addr_t offset);
77 extern status_t intel_allocate_memory(intel_info& info, size_t size,
78 	size_t alignment, uint32 flags, addr_t* _offset,
79 	phys_addr_t* _physicalBase = NULL);
80 extern status_t intel_extreme_init(intel_info& info);
81 extern void intel_extreme_uninit(intel_info& info);
82 
83 #endif  /* INTEL_EXTREME_PRIVATE_H */
84