intel_extreme: Improve tracing
* This was needed to find a bug while working on IvyBridge support. * Code looks a bit cleaner as well now. * If something goes wrong, user is now better notified via syslog
This commit is contained in:
parent
ef769e5e87
commit
5176bea376
@ -28,11 +28,14 @@
|
||||
|
||||
#define TRACE_DEVICE
|
||||
#ifdef TRACE_DEVICE
|
||||
# define TRACE(x) dprintf x
|
||||
# define TRACE(x...) dprintf("intel_extreme: " x)
|
||||
#else
|
||||
# define TRACE(x) ;
|
||||
#endif
|
||||
|
||||
#define ERROR(x...) dprintf("intel_extreme: " x)
|
||||
#define CALLED(x...) TRACE("CALLED %s\n", __PRETTY_FUNCTION__)
|
||||
|
||||
|
||||
/* device hooks prototypes */
|
||||
|
||||
@ -101,7 +104,7 @@ getset_register(int argc, char** argv)
|
||||
static status_t
|
||||
device_open(const char* name, uint32 /*flags*/, void** _cookie)
|
||||
{
|
||||
TRACE((DEVICE_NAME ": open(name = %s)\n", name));
|
||||
CALLED();
|
||||
int32 id;
|
||||
|
||||
// find accessed device
|
||||
@ -147,7 +150,7 @@ device_open(const char* name, uint32 /*flags*/, void** _cookie)
|
||||
static status_t
|
||||
device_close(void* /*data*/)
|
||||
{
|
||||
TRACE((DEVICE_NAME ": close\n"));
|
||||
CALLED();
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@ -183,7 +186,7 @@ device_ioctl(void* data, uint32 op, void* buffer, size_t bufferLength)
|
||||
switch (op) {
|
||||
case B_GET_ACCELERANT_SIGNATURE:
|
||||
strcpy((char*)buffer, INTEL_ACCELERANT_NAME);
|
||||
TRACE((DEVICE_NAME ": accelerant: %s\n", INTEL_ACCELERANT_NAME));
|
||||
TRACE("accelerant: %s\n", INTEL_ACCELERANT_NAME);
|
||||
return B_OK;
|
||||
|
||||
// needed to share data between kernel and accelerant
|
||||
@ -260,8 +263,8 @@ device_ioctl(void* data, uint32 op, void* buffer, size_t bufferLength)
|
||||
}
|
||||
|
||||
default:
|
||||
TRACE((DEVICE_NAME ": ioctl() unknown message %ld (length = %ld)\n",
|
||||
op, bufferLength));
|
||||
ERROR("ioctl() unknown message %ld (length = %ld)\n", op,
|
||||
bufferLength);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -22,13 +22,17 @@
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
#define TRACE_DRIVER
|
||||
#ifdef TRACE_DRIVER
|
||||
# define TRACE(x) dprintf x
|
||||
#define TRACE_DEVICE
|
||||
#ifdef TRACE_DEVICE
|
||||
# define TRACE(x...) dprintf("intel_extreme: " x)
|
||||
#else
|
||||
# define TRACE(x) ;
|
||||
#endif
|
||||
|
||||
#define ERROR(x...) dprintf("intel_extreme: " x)
|
||||
#define CALLED(x...) TRACE("CALLED %s\n", __PRETTY_FUNCTION__)
|
||||
|
||||
|
||||
#define MAX_CARDS 4
|
||||
|
||||
|
||||
@ -134,7 +138,7 @@ get_next_intel_extreme(int32* _cookie, pci_info &info, uint32 &type)
|
||||
extern "C" const char**
|
||||
publish_devices(void)
|
||||
{
|
||||
TRACE((DEVICE_NAME ": publish_devices()\n"));
|
||||
CALLED();
|
||||
return (const char**)gDeviceNames;
|
||||
}
|
||||
|
||||
@ -142,11 +146,11 @@ publish_devices(void)
|
||||
extern "C" status_t
|
||||
init_hardware(void)
|
||||
{
|
||||
TRACE((DEVICE_NAME ": init_hardware()\n"));
|
||||
CALLED();
|
||||
|
||||
status_t status = get_module(B_PCI_MODULE_NAME,(module_info**)&gPCI);
|
||||
if (status != B_OK) {
|
||||
TRACE((DEVICE_NAME ": pci module unavailable\n"));
|
||||
ERROR("pci module unavailable\n");
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -163,17 +167,17 @@ init_hardware(void)
|
||||
extern "C" status_t
|
||||
init_driver(void)
|
||||
{
|
||||
TRACE((DEVICE_NAME ": init_driver()\n"));
|
||||
CALLED();
|
||||
|
||||
status_t status = get_module(B_PCI_MODULE_NAME, (module_info**)&gPCI);
|
||||
if (status != B_OK) {
|
||||
TRACE((DEVICE_NAME ": pci module unavailable\n"));
|
||||
ERROR("pci module unavailable\n");
|
||||
return status;
|
||||
}
|
||||
|
||||
status = get_module(B_AGP_GART_MODULE_NAME, (module_info**)&gGART);
|
||||
if (status != B_OK) {
|
||||
TRACE((DEVICE_NAME ": AGP GART module unavailable\n"));
|
||||
ERROR("AGP GART module unavailable\n");
|
||||
put_module(B_PCI_MODULE_NAME);
|
||||
return status;
|
||||
}
|
||||
@ -245,7 +249,7 @@ init_driver(void)
|
||||
extern "C" void
|
||||
uninit_driver(void)
|
||||
{
|
||||
TRACE((DEVICE_NAME ": uninit_driver()\n"));
|
||||
CALLED();
|
||||
|
||||
mutex_destroy(&gLock);
|
||||
|
||||
@ -264,10 +268,9 @@ uninit_driver(void)
|
||||
extern "C" device_hooks*
|
||||
find_device(const char* name)
|
||||
{
|
||||
CALLED();
|
||||
|
||||
int index;
|
||||
|
||||
TRACE((DEVICE_NAME ": find_device()\n"));
|
||||
|
||||
for (index = 0; gDeviceNames[index] != NULL; index++) {
|
||||
if (!strcmp(name, gDeviceNames[index]))
|
||||
return &gDeviceHooks;
|
||||
|
@ -24,11 +24,14 @@
|
||||
|
||||
#define TRACE_DEVICE
|
||||
#ifdef TRACE_DEVICE
|
||||
# define TRACE(x) dprintf x
|
||||
# define TRACE(x...) dprintf("intel_extreme: " x)
|
||||
#else
|
||||
# define TRACE(x) ;
|
||||
#endif
|
||||
|
||||
#define ERROR(x...) dprintf("intel_extreme: " x)
|
||||
#define CALLED(x...) TRACE("intel_extreme: CALLED %s\n", __PRETTY_FUNCTION__)
|
||||
|
||||
|
||||
static void
|
||||
init_overlay_registers(overlay_registers* registers)
|
||||
@ -161,8 +164,7 @@ init_interrupt_handler(intel_info &info)
|
||||
info.fake_interrupts = true;
|
||||
|
||||
// TODO: fake interrupts!
|
||||
TRACE((DEVICE_NAME "Fake interrupt mode (no PCI interrupt line "
|
||||
"assigned)"));
|
||||
TRACE("Fake interrupt mode (no PCI interrupt line assigned\n");
|
||||
status = B_ERROR;
|
||||
}
|
||||
|
||||
@ -195,10 +197,13 @@ intel_allocate_memory(intel_info &info, size_t size, size_t alignment,
|
||||
status_t
|
||||
intel_extreme_init(intel_info &info)
|
||||
{
|
||||
CALLED();
|
||||
info.aperture = gGART->map_aperture(info.pci->bus, info.pci->device,
|
||||
info.pci->function, 0, &info.aperture_base);
|
||||
if (info.aperture < B_OK)
|
||||
if (info.aperture < B_OK) {
|
||||
ERROR("error: could not map GART aperture!\n");
|
||||
return info.aperture;
|
||||
}
|
||||
|
||||
AreaKeeper sharedCreator;
|
||||
info.shared_area = sharedCreator.Create("intel extreme shared info",
|
||||
@ -206,6 +211,7 @@ intel_extreme_init(intel_info &info)
|
||||
ROUND_TO_PAGE_SIZE(sizeof(intel_shared_info)) + 3 * B_PAGE_SIZE,
|
||||
B_FULL_LOCK, 0);
|
||||
if (info.shared_area < B_OK) {
|
||||
ERROR("error: could not create shared area!\n");
|
||||
gGART->unmap_aperture(info.aperture);
|
||||
return info.shared_area;
|
||||
}
|
||||
@ -238,7 +244,7 @@ intel_extreme_init(intel_info &info)
|
||||
B_ANY_KERNEL_ADDRESS, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA,
|
||||
(void**)&info.registers);
|
||||
if (mmioMapper.InitCheck() < B_OK) {
|
||||
dprintf(DEVICE_NAME ": could not map memory I/O!\n");
|
||||
ERROR("error: could not map memory I/O!\n");
|
||||
gGART->unmap_aperture(info.aperture);
|
||||
return info.registers_area;
|
||||
}
|
||||
@ -294,28 +300,28 @@ intel_extreme_init(intel_info &info)
|
||||
// Fix some problems on certain chips (taken from X driver)
|
||||
// TODO: clean this up
|
||||
if (info.pci->device_id == 0x2a02 || info.pci->device_id == 0x2a12) {
|
||||
dprintf("i965GM/i965GME quirk\n");
|
||||
TRACE("i965GM/i965GME quirk\n");
|
||||
write32(info, 0x6204, (1L << 29));
|
||||
} else if (info.device_type.InGroup(INTEL_TYPE_SNB)) {
|
||||
dprintf("SandyBridge clock gating\n");
|
||||
TRACE("SandyBridge clock gating\n");
|
||||
write32(info, 0x42020, (1L << 28) | (1L << 7) | (1L << 5));
|
||||
} else if (info.device_type.InGroup(INTEL_TYPE_ILK)) {
|
||||
dprintf("IronLake clock gating\n");
|
||||
TRACE("IronLake clock gating\n");
|
||||
write32(info, 0x42020, (1L << 7) | (1L << 5));
|
||||
} else if (info.device_type.InGroup(INTEL_TYPE_G4x)) {
|
||||
dprintf("G4x clock gating\n");
|
||||
TRACE("G4x clock gating\n");
|
||||
write32(info, 0x6204, 0);
|
||||
write32(info, 0x6208, (1L << 9) | (1L << 7) | (1L << 6));
|
||||
write32(info, 0x6210, 0);
|
||||
|
||||
uint32 gateValue = (1L << 28) | (1L << 3) | (1L << 2);
|
||||
if ((info.device_type.type & INTEL_TYPE_MOBILE) == INTEL_TYPE_MOBILE) {
|
||||
dprintf("G4x mobile clock gating\n");
|
||||
TRACE("G4x mobile clock gating\n");
|
||||
gateValue |= 1L << 18;
|
||||
}
|
||||
write32(info, 0x6200, gateValue);
|
||||
} else {
|
||||
dprintf("i965 quirk\n");
|
||||
TRACE("i965 quirk\n");
|
||||
write32(info, 0x6204, (1L << 29) | (1L << 23));
|
||||
}
|
||||
write32(info, 0x7408, 0x10);
|
||||
@ -384,7 +390,7 @@ intel_extreme_init(intel_info &info)
|
||||
|
||||
init_interrupt_handler(info);
|
||||
|
||||
TRACE((DEVICE_NAME "_init() completed successfully!\n"));
|
||||
TRACE("%s: completed successfully!\n", __func__);
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@ -392,7 +398,7 @@ intel_extreme_init(intel_info &info)
|
||||
void
|
||||
intel_extreme_uninit(intel_info &info)
|
||||
{
|
||||
TRACE((DEVICE_NAME": intel_extreme_uninit()\n"));
|
||||
CALLED();
|
||||
|
||||
if (!info.fake_interrupts && info.shared_info->vblank_sem > 0) {
|
||||
// disable interrupt generation
|
||||
|
Loading…
Reference in New Issue
Block a user