Added a get_pci_info() to pci_device_module_info. It was a bit too
complicated to get a pci_info for a given pci_device before. The function is not very efficiently implemented, but I didn't see how to do that without more intrusive changes. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16267 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
0636c5df8b
commit
41f7459c23
@ -110,6 +110,9 @@ typedef struct pci_device_module_info {
|
||||
|
||||
status_t (*allocate_ioports)( uint16 ioport_base, size_t len, const char *name );
|
||||
status_t (*release_ioports)( uint16 ioport_base, size_t len );*/
|
||||
|
||||
status_t (*get_pci_info)(pci_device device, struct pci_info *info);
|
||||
|
||||
} pci_device_module_info;
|
||||
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
#ifndef __PCI_H__
|
||||
#define __PCI_H__
|
||||
|
||||
#include <PCI.h>
|
||||
|
||||
#include "pci_controller.h"
|
||||
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "pci.h"
|
||||
#include "pci_priv.h"
|
||||
|
||||
|
||||
@ -96,6 +97,26 @@ pci_device_ram_address(pci_device_info *device,
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
pci_device_get_pci_info(pci_device device, struct pci_info *info)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (device == NULL || info == NULL)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
// TODO: Implement more efficiently!
|
||||
for (i = 0; pci_get_nth_pci_info(i, info) == B_OK; i++) {
|
||||
if (device->bus == info->bus && device->device == info->device
|
||||
&& device->function == info->function) {
|
||||
return B_OK;
|
||||
}
|
||||
}
|
||||
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
pci_device_init_driver(device_node_handle node, void *user_cookie, void **cookie)
|
||||
{
|
||||
@ -203,4 +224,6 @@ pci_device_module_info gPCIDeviceModule = {
|
||||
pci_device_write_pci_config,
|
||||
|
||||
pci_device_ram_address,
|
||||
|
||||
pci_device_get_pci_info,
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user