added a completely broken way to get the pci_device

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22075 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Marcus Overhagen
2007-08-26 20:45:59 +00:00
parent ebe6d10684
commit 48a55608e6
3 changed files with 16 additions and 8 deletions
@@ -148,6 +148,10 @@ ahci_register_device(device_node_handle parent)
if (status < B_OK)
return status;
// HACK! this device manager stuff just sucks!
extern pci_device pd;
pd = *pciDevice;
// TODO: register SIM for every controller we find!
return register_sim(node);
}
@@ -9,28 +9,31 @@
#define TRACE(a...) dprintf("\33[34mahci:\33[30m " a)
#define FLOW(a...) dprintf("ahci: " a)
// HACK! this device manager stuff just sucks!
pci_device pd;
AHCIController::AHCIController(device_node_handle node, pci_device_module_info *pci, scsi_for_sim_interface * scsi)
AHCIController::AHCIController(device_node_handle node, pci_device_module_info *pci, scsi_for_sim_interface *scsi)
: fNode(node)
, fPCI(pci)
, fSCSI(scsi)
, fPCIDevice(0)
, fDevicePresentMask(0)
{
// HACK! this device manager stuff just sucks!
fPCIDevice = pd;
fDevicePresentMask = (1 << 7) | (1 << 19);
#if 0
uchar cap_ofs;
status_t res = fPCI->find_pci_capability(device, PCI_cap_id_sata, &cap_ofs);
status_t res = fPCI->find_pci_capability(fPCIDevice, PCI_cap_id_sata, &cap_ofs);
if (res == B_OK) {
uint32 satacr0;
uint32 satacr1;
TRACE("PCI SATA capability found at offset 0x%x\n", cap_ofs);
satacr0 = pci->read_pci_config(device, cap_ofs, 4);
satacr1 = pci->read_pci_config(device, cap_ofs + 4, 4);
TRACE("satacr0 = 0x%08x, satacr1 = 0x%08x\n", satacr0, satacr1);
satacr0 = fPCI->read_pci_config(fPCIDevice, cap_ofs, 4);
satacr1 = fPCI->read_pci_config(fPCIDevice, cap_ofs + 4, 4);
TRACE("satacr0 = 0x%08lx, satacr1 = 0x%08lx\n", satacr0, satacr1);
}
#endif
}
@@ -28,7 +28,8 @@ private:
private:
device_node_handle fNode;
pci_device_module_info * fPCI;
scsi_for_sim_interface * fSCSI;
scsi_for_sim_interface * fSCSI;
pci_device fPCIDevice;
uint32 fDevicePresentMask;
};