* Replaced benaphore use with a mutex.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34236 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2006-2008, Haiku, Inc. All Rights Reserved.
|
* Copyright 2006-2009, Haiku, Inc. All Rights Reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -116,7 +116,7 @@ device_open(const char *name, uint32 /*flags*/, void **_cookie)
|
|||||||
|
|
||||||
intel_info *info = gDeviceInfo[id];
|
intel_info *info = gDeviceInfo[id];
|
||||||
|
|
||||||
acquire_lock(&gLock);
|
mutex_lock(&gLock);
|
||||||
|
|
||||||
if (info->open_count == 0) {
|
if (info->open_count == 0) {
|
||||||
// this device has been opened for the first time, so
|
// this device has been opened for the first time, so
|
||||||
@@ -132,7 +132,7 @@ device_open(const char *name, uint32 /*flags*/, void **_cookie)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
release_lock(&gLock);
|
mutex_unlock(&gLock);
|
||||||
|
|
||||||
if (info->init_status == B_OK)
|
if (info->init_status == B_OK)
|
||||||
*_cookie = info;
|
*_cookie = info;
|
||||||
@@ -154,7 +154,7 @@ device_free(void *data)
|
|||||||
{
|
{
|
||||||
struct intel_info *info = (intel_info *)data;
|
struct intel_info *info = (intel_info *)data;
|
||||||
|
|
||||||
acquire_lock(&gLock);
|
mutex_lock(&gLock);
|
||||||
|
|
||||||
if (info->open_count-- == 1) {
|
if (info->open_count-- == 1) {
|
||||||
// release info structure
|
// release info structure
|
||||||
@@ -166,7 +166,7 @@ device_free(void *data)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
release_lock(&gLock);
|
mutex_unlock(&gLock);
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2006-2008, Haiku, Inc. All Rights Reserved.
|
* Copyright 2006-2009, Haiku, Inc. All Rights Reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -21,6 +21,7 @@
|
|||||||
#include <PCI.h>
|
#include <PCI.h>
|
||||||
#include <SupportDefs.h>
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
|
|
||||||
#define TRACE_DRIVER
|
#define TRACE_DRIVER
|
||||||
#ifdef TRACE_DRIVER
|
#ifdef TRACE_DRIVER
|
||||||
# define TRACE(x) dprintf x
|
# define TRACE(x) dprintf x
|
||||||
@@ -30,6 +31,7 @@
|
|||||||
|
|
||||||
#define MAX_CARDS 4
|
#define MAX_CARDS 4
|
||||||
|
|
||||||
|
|
||||||
// list of supported devices
|
// list of supported devices
|
||||||
const struct supported_device {
|
const struct supported_device {
|
||||||
uint32 device_id;
|
uint32 device_id;
|
||||||
@@ -63,7 +65,7 @@ char *gDeviceNames[MAX_CARDS + 1];
|
|||||||
intel_info* gDeviceInfo[MAX_CARDS];
|
intel_info* gDeviceInfo[MAX_CARDS];
|
||||||
pci_module_info* gPCI;
|
pci_module_info* gPCI;
|
||||||
agp_gart_module_info* gGART;
|
agp_gart_module_info* gGART;
|
||||||
lock gLock;
|
mutex gLock;
|
||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
@@ -142,12 +144,7 @@ init_driver(void)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = init_lock(&gLock, "intel extreme ksync");
|
mutex_init(&gLock, "intel extreme ksync");
|
||||||
if (status < B_OK) {
|
|
||||||
put_module(B_AGP_GART_MODULE_NAME);
|
|
||||||
put_module(B_PCI_MODULE_NAME);
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
// find devices
|
// find devices
|
||||||
|
|
||||||
@@ -201,7 +198,7 @@ init_driver(void)
|
|||||||
gDeviceNames[found] = NULL;
|
gDeviceNames[found] = NULL;
|
||||||
|
|
||||||
if (found == 0) {
|
if (found == 0) {
|
||||||
uninit_lock(&gLock);
|
mutex_destroy(&gLock);
|
||||||
put_module(B_AGP_GART_MODULE_NAME);
|
put_module(B_AGP_GART_MODULE_NAME);
|
||||||
put_module(B_PCI_MODULE_NAME);
|
put_module(B_PCI_MODULE_NAME);
|
||||||
return ENODEV;
|
return ENODEV;
|
||||||
@@ -216,7 +213,7 @@ uninit_driver(void)
|
|||||||
{
|
{
|
||||||
TRACE((DEVICE_NAME ": uninit_driver()\n"));
|
TRACE((DEVICE_NAME ": uninit_driver()\n"));
|
||||||
|
|
||||||
uninit_lock(&gLock);
|
mutex_destroy(&gLock);
|
||||||
|
|
||||||
// free device related structures
|
// free device related structures
|
||||||
char* name;
|
char* name;
|
||||||
@@ -245,17 +242,3 @@ find_device(const char *name)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
extern "C" void
|
|
||||||
wake_driver(void)
|
|
||||||
{
|
|
||||||
// for compatibility with Dano, only
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
extern "C" void
|
|
||||||
suspend_driver(void)
|
|
||||||
{
|
|
||||||
// for compatibility with Dano, only
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2006-2008, Haiku, Inc. All Rights Reserved.
|
* Copyright 2006-2009, Haiku, Inc. All Rights Reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -12,6 +12,8 @@
|
|||||||
#include <KernelExport.h>
|
#include <KernelExport.h>
|
||||||
#include <PCI.h>
|
#include <PCI.h>
|
||||||
|
|
||||||
|
#include <kernel/lock.h>
|
||||||
|
|
||||||
#include "intel_extreme_private.h"
|
#include "intel_extreme_private.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -29,20 +31,22 @@ extern char *gDeviceNames[];
|
|||||||
extern intel_info* gDeviceInfo[];
|
extern intel_info* gDeviceInfo[];
|
||||||
extern pci_module_info* gPCI;
|
extern pci_module_info* gPCI;
|
||||||
extern agp_gart_module_info* gGART;
|
extern agp_gart_module_info* gGART;
|
||||||
extern struct lock gLock;
|
extern mutex gLock;
|
||||||
|
|
||||||
|
|
||||||
static inline uint32
|
static inline uint32
|
||||||
get_pci_config(pci_info* info, uint8 offset, uint8 size)
|
get_pci_config(pci_info* info, uint8 offset, uint8 size)
|
||||||
{
|
{
|
||||||
return gPCI->read_pci_config(info->bus, info->device, info->function, offset, size);
|
return gPCI->read_pci_config(info->bus, info->device, info->function,
|
||||||
|
offset, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
set_pci_config(pci_info* info, uint8 offset, uint8 size, uint32 value)
|
set_pci_config(pci_info* info, uint8 offset, uint8 size, uint32 value)
|
||||||
{
|
{
|
||||||
gPCI->write_pci_config(info->bus, info->device, info->function, offset, size, value);
|
gPCI->write_pci_config(info->bus, info->device, info->function, offset,
|
||||||
|
size, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* DRIVER_H */
|
#endif /* DRIVER_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user