2 * Copyright 2005-2009, Axel Dörfler, axeld@pinc-software.de.
3 * Distributed under the terms of the MIT License.
8 #include <KernelExport.h>
9 #include <SupportDefs.h>
11 #include <frame_buffer_console.h>
12 #include <boot_item.h>
25 # define TRACE(x) dprintf x
33 int32 api_version
= B_CUR_DRIVER_API_VERSION
;
35 char* gDeviceNames
[MAX_CARDS
+ 1];
36 vesa_info
* gDeviceInfo
[MAX_CARDS
];
37 isa_module_info
* gISA
;
41 extern "C" const char**
44 TRACE((DEVICE_NAME
": publish_devices()\n"));
45 return (const char**)gDeviceNames
;
52 TRACE((DEVICE_NAME
": init_hardware()\n"));
54 return get_boot_item(FRAME_BUFFER_BOOT_INFO
, NULL
) != NULL
? B_OK
: B_ERROR
;
61 TRACE((DEVICE_NAME
": init_driver()\n"));
63 gDeviceInfo
[0] = (vesa_info
*)malloc(sizeof(vesa_info
));
64 if (gDeviceInfo
[0] == NULL
)
67 memset(gDeviceInfo
[0], 0, sizeof(vesa_info
));
69 status_t status
= get_module(B_ISA_MODULE_NAME
, (module_info
**)&gISA
);
73 gDeviceNames
[0] = strdup("graphics/vesa");
74 if (gDeviceNames
[0] == NULL
) {
79 gDeviceNames
[1] = NULL
;
81 mutex_init(&gLock
, "vesa lock");
85 put_module(B_ISA_MODULE_NAME
);
95 TRACE((DEVICE_NAME
": uninit_driver()\n"));
97 put_module(B_ISA_MODULE_NAME
);
98 mutex_destroy(&gLock
);
100 // free device related structures
102 for (int32 index
= 0; (name
= gDeviceNames
[index
]) != NULL
; index
++) {
103 free(gDeviceInfo
[index
]);
109 extern "C" device_hooks
*
110 find_device(const char* name
)
114 TRACE((DEVICE_NAME
": find_device()\n"));
116 for (index
= 0; gDeviceNames
[index
] != NULL
; index
++) {
117 if (!strcmp(name
, gDeviceNames
[index
]))
118 return &gDeviceHooks
;