Make UEFI boot-platform build again
[haiku.git] / headers / private / graphics / vmware / DriverInterface.h
blobd9b366ee2b0191d902457c57beb884a45f4d82fd
1 /*
2 * Copyright 1999, Be Incorporated.
3 * Copyright 2007, Haiku.
4 * Distributed under the terms of the MIT License.
6 * Authors:
7 * Be Incorporated
8 * Eric Petit <eric.petit@lapsus.org>
9 * Michael Pfeiffer <laplace@users.sourceforge.net>
12 #ifndef DRIVERINTERFACE_H
13 #define DRIVERINTERFACE_H
15 #include <GraphicsDefs.h>
16 #include <Accelerant.h>
17 #include <Drivers.h>
18 #include <PCI.h>
19 #include <OS.h>
21 #include "vm_device_version.h"
22 #include "svga_reg.h"
24 #define MAX_SAMPLE_DEVICE_NAME_LENGTH 32
25 #define CURSOR_ID 1
28 /*--------------------------------------------------------------------*/
29 /* Benaphores */
31 typedef struct {
32 sem_id sem;
33 int32 ben;
34 } Benaphore;
35 #define INIT_BEN(x) x.sem = create_sem(0, "VMware "#x); x.ben = 0;
36 #define ACQUIRE_BEN(x) if((atomic_add(&(x.ben), 1)) >= 1) acquire_sem(x.sem);
37 #define RELEASE_BEN(x) if((atomic_add(&(x.ben), -1)) > 1) release_sem(x.sem);
38 #define DELETE_BEN(x) delete_sem(x.sem);
41 /*--------------------------------------------------------------------*/
42 /* Utils */
44 #define ROUND_TO_PAGE_SIZE(x) (((x)+(B_PAGE_SIZE)-1)&~((B_PAGE_SIZE)-1))
46 static inline int
47 BppForSpace(int space)
49 switch (space) {
50 case B_RGB32:
51 return 32;
52 case B_RGB24:
53 return 24;
54 case B_RGB16:
55 return 16;
56 case B_RGB15:
57 return 15;
58 case B_CMAP8:
59 return 8;
61 return 0;
65 /*--------------------------------------------------------------------*/
66 /* Request codes for ioctl() */
68 enum {
69 VMWARE_GET_PRIVATE_DATA = B_DEVICE_OP_CODES_END + 1,
70 VMWARE_FIFO_START,
71 VMWARE_FIFO_STOP,
72 VMWARE_FIFO_SYNC,
73 VMWARE_SET_MODE,
74 VMWARE_SHOW_CURSOR,
75 VMWARE_MOVE_CURSOR,
76 VMWARE_GET_DEVICE_NAME,
77 VMWARE_SET_PALETTE
81 /*--------------------------------------------------------------------*/
82 /* Structure shared between the kernel driver and the accelerant */
84 typedef struct {
85 /* Device info and capabilities */
86 uint16 vendorId;
87 uint16 deviceId;
88 uint8 revision;
89 uint32 maxWidth;
90 uint32 maxHeight;
91 void *fbDma;
92 uint32 fbSize;
93 void *fifoDma;
94 uint32 fifoSize;
95 uint32 fifoMin;
96 uint32 capabilities;
97 uint32 fifoCapabilities;
98 uint32 fifoFlags;
100 /* For registers access */
101 uint16 indexPort;
102 uint16 valuePort;
104 /* Mapped areas */
105 area_id fbArea;
106 void *fb;
107 area_id fifoArea;
108 void *fifo;
110 /* This changes when we switch to another mode */
111 uint32 fbOffset;
112 uint32 bytesPerRow;
114 /* Current display mode */
115 display_mode dm;
117 Benaphore engineLock;
118 Benaphore fifoLock;
119 uint32 fifoNext;
121 /* Cursor state */
122 bool cursorShow;
123 uint16 cursorX;
124 uint16 cursorY;
125 } SharedInfo;
127 #endif