Patch by Duane on IRC, makes it build again (but won't work). Needs investigation.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26967 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -80,13 +80,14 @@ struct openpic_info : interrupt_controller_info {
|
|||||||
|
|
||||||
// uninit parent node driver
|
// uninit parent node driver
|
||||||
if (pci)
|
if (pci)
|
||||||
sDeviceManager->uninit_driver(sDeviceManager->get_parent(node));
|
//XXX do I mean it ?
|
||||||
|
sDeviceManager->put_node(sDeviceManager->get_parent_node(node));
|
||||||
}
|
}
|
||||||
|
|
||||||
openpic_supported_device *supported_device;
|
openpic_supported_device *supported_device;
|
||||||
device_node_handle node;
|
device_node *node;
|
||||||
pci_device_module_info *pci;
|
pci_device_module_info *pci;
|
||||||
pci_device device;
|
pci_device *device;
|
||||||
|
|
||||||
addr_t physical_registers; // physical registers base
|
addr_t physical_registers; // physical registers base
|
||||||
addr_t virtual_registers; // virtual (mapped)
|
addr_t virtual_registers; // virtual (mapped)
|
||||||
@@ -278,23 +279,22 @@ openpic_std_ops(int32 op, ...)
|
|||||||
|
|
||||||
|
|
||||||
static float
|
static float
|
||||||
openpic_supports_device(device_node_handle parent, bool *_noConnection)
|
openpic_supports_device(device_node *parent)
|
||||||
{
|
{
|
||||||
char *bus;
|
const char *bus;
|
||||||
uint16 vendorID;
|
uint16 vendorID;
|
||||||
uint16 deviceID;
|
uint16 deviceID;
|
||||||
|
|
||||||
// get the bus (should be PCI)
|
// get the bus (should be PCI)
|
||||||
if (sDeviceManager->get_attr_string(parent, B_DRIVER_BUS, &bus, false)
|
if (sDeviceManager->get_attr_string(parent, B_DEVICE_BUS, &bus, false)
|
||||||
!= B_OK) {
|
!= B_OK) {
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
MemoryDeleter _(bus);
|
|
||||||
|
|
||||||
// get vendor and device ID
|
// get vendor and device ID
|
||||||
if (sDeviceManager->get_attr_uint16(parent, PCI_DEVICE_VENDOR_ID_ITEM,
|
if (sDeviceManager->get_attr_uint16(parent, B_DEVICE_VENDOR_ID,
|
||||||
&vendorID, false) != B_OK
|
&vendorID, false) != B_OK
|
||||||
|| sDeviceManager->get_attr_uint16(parent, PCI_DEVICE_DEVICE_ID_ITEM,
|
|| sDeviceManager->get_attr_uint16(parent, B_DEVICE_ID,
|
||||||
&deviceID, false) != B_OK) {
|
&deviceID, false) != B_OK) {
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
@@ -310,35 +310,46 @@ openpic_supports_device(device_node_handle parent, bool *_noConnection)
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
openpic_register_device(device_node_handle parent)
|
openpic_register_device(device_node *parent)
|
||||||
{
|
{
|
||||||
// get interface to PCI device
|
#if 0 //XXX: what do I do ?
|
||||||
pci_device_module_info *pci;
|
// get interface to PCI device
|
||||||
pci_device device;
|
pci_device_module_info *pci;
|
||||||
status_t error = sDeviceManager->init_driver(parent, NULL,
|
pci_device *device;
|
||||||
(driver_module_info**)&pci, (void**)&device);
|
driver_module_info *driver;
|
||||||
if (error != B_OK)
|
void *cookie;
|
||||||
return error;
|
status_t error;
|
||||||
|
error = sDeviceManager->get_driver(parent, &driver, &cookie);
|
||||||
sDeviceManager->uninit_driver(parent);
|
if (error < B_OK)
|
||||||
|
return error;
|
||||||
device_attr attrs[] = {
|
error = driver->init_driver(parent, cookie);
|
||||||
// info about ourself
|
// (driver_module_info**)&pci, (void**)&device); // wtf?
|
||||||
{ B_DRIVER_MODULE, B_STRING_TYPE, { string: OPENPIC_MODULE_NAME }},
|
if (error != B_OK)
|
||||||
{ B_DRIVER_DEVICE_TYPE, B_STRING_TYPE,
|
return error;
|
||||||
{ string: B_INTERRUPT_CONTROLLER_DRIVER_TYPE }},
|
|
||||||
|
sDeviceManager->uninit_driver(parent);
|
||||||
{}
|
#endif
|
||||||
};
|
device_node *newNode;
|
||||||
|
device_attr attrs[] = {
|
||||||
return sDeviceManager->register_device(parent, attrs, NULL, NULL);
|
// info about ourself
|
||||||
|
//{ B_DRIVER_MODULE, B_STRING_TYPE, { string: OPENPIC_MODULE_NAME }},
|
||||||
|
//XXX: that's inconsistent with the header!
|
||||||
|
//{ B_DEVICE_TYPE, B_STRING_TYPE,
|
||||||
|
// { string: B_INTERRUPT_CONTROLLER_DRIVER_TYPE }},
|
||||||
|
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
// HACK: to get it compiled, I will break anything.
|
||||||
|
return sDeviceManager->register_node(parent, NULL, attrs, NULL, &newNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
openpic_init_driver(device_node_handle node, void *user_cookie,
|
openpic_init_driver(device_node *node, void **cookie)
|
||||||
void **cookie)
|
|
||||||
{
|
{
|
||||||
|
// OK, this module is broken for now. But it compiles.
|
||||||
|
return B_ERROR;
|
||||||
openpic_info *info = new(nothrow) openpic_info;
|
openpic_info *info = new(nothrow) openpic_info;
|
||||||
if (!info)
|
if (!info)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
@@ -347,17 +358,25 @@ openpic_init_driver(device_node_handle node, void *user_cookie,
|
|||||||
info->node = node;
|
info->node = node;
|
||||||
|
|
||||||
// get interface to PCI device
|
// get interface to PCI device
|
||||||
status_t error = sDeviceManager->init_driver(
|
void *aCookie;
|
||||||
|
void *anotherCookie; // possibly the same cookie.
|
||||||
|
driver_module_info *driver;
|
||||||
|
status_t status = sDeviceManager->get_driver(sDeviceManager->get_parent_node(node),
|
||||||
|
&driver, &aCookie);
|
||||||
|
if (status != B_OK)
|
||||||
|
return status;
|
||||||
|
|
||||||
|
driver->init_driver(node, &anotherCookie);
|
||||||
|
|
||||||
|
/* status = sDeviceManager->init_driver(
|
||||||
sDeviceManager->get_parent(node), NULL,
|
sDeviceManager->get_parent(node), NULL,
|
||||||
(driver_module_info**)&info->pci, (void**)&info->device);
|
(driver_module_info**)&info->pci, (void**)&info->device);
|
||||||
if (error != B_OK)
|
if (status != B_OK)
|
||||||
return error;
|
return status; */
|
||||||
|
|
||||||
// get the pci info for the device
|
// get the pci info for the device
|
||||||
pci_info pciInfo;
|
pci_info pciInfo;
|
||||||
error = info->pci->get_pci_info(info->device, &pciInfo);
|
info->pci->get_pci_info(info->device, &pciInfo);
|
||||||
if (error != B_OK)
|
|
||||||
return error;
|
|
||||||
|
|
||||||
// find supported device info
|
// find supported device info
|
||||||
info->supported_device = openpic_check_supported_device(pciInfo.vendor_id,
|
info->supported_device = openpic_check_supported_device(pciInfo.vendor_id,
|
||||||
@@ -397,9 +416,9 @@ openpic_init_driver(device_node_handle node, void *user_cookie,
|
|||||||
info->virtual_registers = (addr_t)virtualRegisterBase;
|
info->virtual_registers = (addr_t)virtualRegisterBase;
|
||||||
|
|
||||||
// init the controller
|
// init the controller
|
||||||
error = openpic_init(info);
|
status = openpic_init(info);
|
||||||
if (error != B_OK)
|
if (status != B_OK)
|
||||||
return error;
|
return status;
|
||||||
|
|
||||||
// keep the info
|
// keep the info
|
||||||
infoDeleter.Detach();
|
infoDeleter.Detach();
|
||||||
@@ -411,26 +430,25 @@ openpic_init_driver(device_node_handle node, void *user_cookie,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static status_t
|
static void
|
||||||
openpic_uninit_driver(void *cookie)
|
openpic_uninit_driver(void *cookie)
|
||||||
{
|
{
|
||||||
openpic_info *info = (openpic_info*)cookie;
|
openpic_info *info = (openpic_info*)cookie;
|
||||||
|
|
||||||
delete info;
|
delete info;
|
||||||
|
|
||||||
return B_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
openpic_device_removed(device_node_handle node, void *cookie)
|
openpic_device_removed(void *driverCookie)
|
||||||
{
|
{
|
||||||
// TODO: ...
|
// TODO: ...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
// FIXME: I don't think this is needed...
|
||||||
openpic_get_paths(const char ***_bus, const char ***_device)
|
/*static void
|
||||||
|
openpic_get_paths(const char **_bus, const char **_device)
|
||||||
{
|
{
|
||||||
static const char *kBus[] = { "pci", NULL };
|
static const char *kBus[] = { "pci", NULL };
|
||||||
// static const char *kDevice[] = { "drivers/dev/disk/ide", NULL };
|
// static const char *kDevice[] = { "drivers/dev/disk/ide", NULL };
|
||||||
@@ -438,7 +456,7 @@ openpic_get_paths(const char ***_bus, const char ***_device)
|
|||||||
*_bus = kBus;
|
*_bus = kBus;
|
||||||
// *_device = kDevice;
|
// *_device = kDevice;
|
||||||
*_device = NULL;
|
*_device = NULL;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark - interrupt_controller interface
|
// #pragma mark - interrupt_controller interface
|
||||||
@@ -512,9 +530,11 @@ static interrupt_controller_module_info sControllerModuleInfo = {
|
|||||||
openpic_register_device,
|
openpic_register_device,
|
||||||
openpic_init_driver,
|
openpic_init_driver,
|
||||||
openpic_uninit_driver,
|
openpic_uninit_driver,
|
||||||
|
NULL, // HACK: register_child_devices
|
||||||
|
NULL, // HACK: rescan_child_devices
|
||||||
openpic_device_removed,
|
openpic_device_removed,
|
||||||
NULL, // cleanup
|
NULL, // suspend
|
||||||
openpic_get_paths,
|
NULL // resume
|
||||||
},
|
},
|
||||||
|
|
||||||
openpic_get_controller_info,
|
openpic_get_controller_info,
|
||||||
|
|||||||
Reference in New Issue
Block a user