xref: /haiku/headers/private/graphics/AGP.h (revision 1d9d47fc72028bb71b5f232a877231e59cfe2438)
1 /*******************************************************************************
2 /
3 /	File:		AGP.h
4 /
5 /	Description:	Interface to the AGP bus and driver.
6 /	For more information, see "AGP interface specification", Revision 2.0 and 3.0,
7 /	Intel Corporation, 1998-2002.
8 /
9 /	Rudolf Cornelissen 6/2004-7/2004.
10 /
11 *******************************************************************************/
12 
13 #if !defined(_AGP_H_)
14 #define _AGP_H_
15 
16 #include <bus_manager.h>
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 
23 /* -----
24 	agp device info
25 ----- */
26 
27 typedef struct agp_info {
28 	ushort	vendor_id;				/* vendor id */
29 	ushort	device_id;				/* device id */
30 	uchar	bus;					/* bus number */
31 	uchar	device;					/* device number on bus */
32 	uchar	function;				/* function number in device */
33 	uchar	class_sub;				/* specific device function */
34 	uchar	class_base;				/* device type (display vs host bridge) */
35 	struct
36 	{
37 		uint32	agp_cap_id;	/* AGP capability register as defined in the AGP standard */
38 		uint32	agp_stat;	/* AGP STATUS register as defined in the AGP standard */
39 		uint32	agp_cmd;	/* AGP COMMAND register as defined in the AGP standard */
40 	} interface;
41 	status_t	status;		/* B_OK if usable, B_ERROR if device did not respond
42 							 * according to the AGP standard */
43 } agp_info;
44 
45 typedef struct agp_module_info agp_module_info;
46 
47 struct agp_module_info {
48 	bus_manager_info	binfo;
49 
50 	long			(*get_nth_agp_info) (
51 						long		index,	/* index into agp device table */
52 						agp_info 	*info	/* caller-supplied buffer for info */
53 					);
54 	void			(*enable_agp) (
55 						uint32	*command	/* max. mode to set */
56 					);
57 	//fixme: GART and APERTURE stuff is lacking for now, add here...
58 };
59 
60 #define	B_AGP_MODULE_NAME		"bus_managers/agp/v0"
61 
62 
63 /* ---
64 	value for the AGP_id field in the agp_cap_id register
65 --- */
66 #define AGP_id	0x02	/* AGP device identification */
67 
68 
69 /* ---
70 	masks for capability ID register bits
71 --- */
72 #define AGP_id_mask		0x000000ff	/* AGP capability identification, contains value 0x02 for AGP device */
73 #define AGP_next_ptr	0x0000ff00	/* pointer to next item in PCI capabilities list, contains 0x00 if this is last item */
74 #define AGP_next_ptr_shift		 8
75 #define AGP_rev_minor	0x000f0000	/* AGP Revision minor number reported */
76 #define AGP_rev_minor_shift		16
77 #define AGP_rev_major	0x00f00000	/* AGP Revision major number reported */
78 #define AGP_rev_major_shift		20
79 
80 
81 /* ---
82 	masks for status and command register bits
83 --- */
84 #define AGP_2_1x		0x00000001	/* AGP Revision 2.0 1x speed transfer mode */
85 #define AGP_2_2x		0x00000002	/* AGP Revision 2.0 2x speed transfer mode */
86 #define AGP_2_4x		0x00000004	/* AGP Revision 2.0 4x speed transfer mode */
87 #define AGP_3_4x		0x00000001	/* AGP Revision 3.0 4x speed transfer mode */
88 #define AGP_3_8x		0x00000002	/* AGP Revision 3.0 8x speed transfer mode */
89 #define AGP_rates		0x00000007	/* mask for supported rates info */
90 #define AGP_rate_rev	0x00000008	/* 0 if AGP Revision 2.0 or earlier rate scheme, 1 if AGP Revision 3.0 rate scheme */
91 #define AGP_FW			0x00000010	/* 1 if fastwrite transfers supported */
92 #define AGP_4G			0x00000020	/* 1 if adresses above 4G bytes supported */
93 #define AGP_SBA			0x00000200	/* 1 if sideband adressing supported */
94 #define AGP_RQ			0xff000000	/* max. number of enqueued AGP command requests supported, minus one */
95 #define AGP_RQ_shift			24
96 
97 
98 /* ---
99 	masks for command register bits
100 --- */
101 #define AGP_enable		0x00000100	/* set to 1 if AGP should be enabled */
102 
103 
104 #ifdef __cplusplus
105 }
106 #endif
107 
108 #endif
109