Port legacy_sata to new driver architecture. However, based on device manager's kernel debugger output it's still using the generic_ide driver for my controller instead. Axel, please review.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25688 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -145,7 +145,7 @@ AddFilesToHaikuImage beos system add-ons kernel bus_managers
|
|||||||
AddFilesToHaikuImage beos system add-ons kernel busses agp_gart
|
AddFilesToHaikuImage beos system add-ons kernel busses agp_gart
|
||||||
: $(X86_ONLY)<agp_gart>intel ;
|
: $(X86_ONLY)<agp_gart>intel ;
|
||||||
AddFilesToHaikuImage beos system add-ons kernel busses ide
|
AddFilesToHaikuImage beos system add-ons kernel busses ide
|
||||||
: generic_ide_pci silicon_image_3112 ; #$(X86_ONLY)ide_isa legacy_sata ;
|
: generic_ide_pci silicon_image_3112 legacy_sata ; #$(X86_ONLY)ide_isa ;
|
||||||
AddFilesToHaikuImage beos system add-ons kernel busses scsi
|
AddFilesToHaikuImage beos system add-ons kernel busses scsi
|
||||||
: ahci ;
|
: ahci ;
|
||||||
AddFilesToHaikuImage beos system add-ons kernel busses usb
|
AddFilesToHaikuImage beos system add-ons kernel busses usb
|
||||||
|
|||||||
@@ -61,25 +61,23 @@ static ide_adapter_interface* ide_adapter;
|
|||||||
static device_manager_info* dm;
|
static device_manager_info* dm;
|
||||||
|
|
||||||
static float
|
static float
|
||||||
controller_supports(device_node_handle parent, bool *_noConnection)
|
controller_supports(device_node *parent)
|
||||||
{
|
{
|
||||||
uint16 vendor_id;
|
uint16 vendor_id;
|
||||||
uint16 device_id;
|
uint16 device_id;
|
||||||
status_t res;
|
status_t res;
|
||||||
char *bus;
|
const char *bus = NULL;
|
||||||
|
|
||||||
// get the bus (should be PCI)
|
// get the bus (should be PCI)
|
||||||
if (dm->get_attr_string(parent, B_DRIVER_BUS, &bus, false) != B_OK)
|
if (dm->get_attr_string(parent, B_DEVICE_BUS, &bus, false) != B_OK)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
if (strcmp(bus, "pci") != 0) {
|
if (strcmp(bus, "pci") != 0) {
|
||||||
free(bus);
|
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
free(bus);
|
|
||||||
|
|
||||||
// get vendor and device ID
|
// get vendor and device ID
|
||||||
if ((res=dm->get_attr_uint16(parent, PCI_DEVICE_VENDOR_ID_ITEM, &vendor_id, false)) != B_OK
|
if ((res=dm->get_attr_uint16(parent, B_DEVICE_VENDOR_ID, &vendor_id, false)) != B_OK
|
||||||
|| (res=dm->get_attr_uint16(parent, PCI_DEVICE_DEVICE_ID_ITEM, &device_id, false)) != B_OK) {
|
|| (res=dm->get_attr_uint16(parent, B_DEVICE_ID, &device_id, false)) != B_OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,16 +122,16 @@ controller_supports(device_node_handle parent, bool *_noConnection)
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
controller_probe(device_node_handle parent)
|
controller_probe(device_node *parent)
|
||||||
{
|
{
|
||||||
device_node_handle controller_node;
|
device_node *controller_node;
|
||||||
device_node_handle channels[4];
|
device_node *channels[4];
|
||||||
uint16 command_block_base[4];
|
uint16 command_block_base[4];
|
||||||
uint16 control_block_base[4];
|
uint16 control_block_base[4];
|
||||||
pci_device_module_info *pci;
|
pci_device_module_info *pci;
|
||||||
uint8 num_channels = 2;
|
uint8 num_channels = 2;
|
||||||
uint32 bus_master_base;
|
uint32 bus_master_base;
|
||||||
pci_device device;
|
pci_device *device = NULL;
|
||||||
uint16 device_id;
|
uint16 device_id;
|
||||||
uint16 vendor_id;
|
uint16 vendor_id;
|
||||||
uint8 int_num;
|
uint8 int_num;
|
||||||
@@ -142,8 +140,7 @@ controller_probe(device_node_handle parent)
|
|||||||
|
|
||||||
TRACE("controller_probe\n");
|
TRACE("controller_probe\n");
|
||||||
|
|
||||||
if ((res=dm->init_driver(parent, NULL, (driver_module_info **)&pci, (void **)&device)) != B_OK)
|
dm->get_driver(parent, (driver_module_info **)&pci, (void **)&device);
|
||||||
return res;
|
|
||||||
|
|
||||||
device_id = pci->read_pci_config(device, PCI_device_id, 2);
|
device_id = pci->read_pci_config(device, PCI_device_id, 2);
|
||||||
vendor_id = pci->read_pci_config(device, PCI_vendor_id, 2);
|
vendor_id = pci->read_pci_config(device, PCI_vendor_id, 2);
|
||||||
@@ -218,13 +215,10 @@ controller_probe(device_node_handle parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
dm->uninit_driver(parent);
|
|
||||||
|
|
||||||
TRACE("controller_probe success\n");
|
TRACE("controller_probe success\n");
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
dm->uninit_driver(parent);
|
|
||||||
TRACE("controller_probe failed (%s)\n", strerror(res));
|
TRACE("controller_probe failed (%s)\n", strerror(res));
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -232,64 +226,50 @@ err:
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
controller_init(device_node_handle node, void *user_cookie, void **controller_cookie)
|
controller_init(device_node *node, void **controller_cookie)
|
||||||
{
|
{
|
||||||
return ide_adapter->init_controller(
|
return ide_adapter->init_controller(
|
||||||
node,user_cookie,
|
node, (ide_adapter_controller_info**)controller_cookie,
|
||||||
(ide_adapter_controller_info**)controller_cookie,
|
|
||||||
sizeof(ide_adapter_controller_info));
|
sizeof(ide_adapter_controller_info));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static status_t
|
static void
|
||||||
controller_uninit(void *controller_cookie)
|
controller_uninit(void *controller_cookie)
|
||||||
{
|
{
|
||||||
return ide_adapter->uninit_controller(controller_cookie);
|
ide_adapter->uninit_controller(controller_cookie);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
controller_removed(device_node_handle node, void *controller_cookie)
|
controller_removed(void *controller_cookie)
|
||||||
{
|
{
|
||||||
ide_adapter->controller_removed(
|
ide_adapter->controller_removed(
|
||||||
node,
|
|
||||||
(ide_adapter_controller_info*)controller_cookie);
|
(ide_adapter_controller_info*)controller_cookie);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
controller_get_paths(const char ***_bus, const char ***_device)
|
|
||||||
{
|
|
||||||
static const char *kBus[] = { "pci", NULL };
|
|
||||||
static const char *kDevice[] = { "drivers/dev/disk/sata", NULL };
|
|
||||||
|
|
||||||
*_bus = kBus;
|
|
||||||
*_device = kDevice;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
channel_init(device_node_handle node, void *user_cookie, void **channel_cookie)
|
channel_init(device_node *node, void **channel_cookie)
|
||||||
{
|
{
|
||||||
return ide_adapter->init_channel(
|
return ide_adapter->init_channel(
|
||||||
node,
|
node,
|
||||||
user_cookie,
|
|
||||||
(ide_adapter_channel_info**)channel_cookie,
|
(ide_adapter_channel_info**)channel_cookie,
|
||||||
sizeof(ide_adapter_channel_info),
|
sizeof(ide_adapter_channel_info),
|
||||||
ide_adapter->inthand);
|
ide_adapter->inthand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static status_t
|
static void
|
||||||
channel_uninit(void *channel_cookie)
|
channel_uninit(void *channel_cookie)
|
||||||
{
|
{
|
||||||
return ide_adapter->uninit_channel(channel_cookie);
|
ide_adapter->uninit_channel(channel_cookie);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
channel_removed(device_node_handle node, void *channel_cookie)
|
channel_removed(void *channel_cookie)
|
||||||
{
|
{
|
||||||
ide_adapter->channel_removed(node,channel_cookie);
|
ide_adapter->channel_removed(channel_cookie);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -356,21 +336,6 @@ dma_finish(void *channel_cookie)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static status_t
|
|
||||||
std_ops(int32 op, ...)
|
|
||||||
{
|
|
||||||
switch (op) {
|
|
||||||
case B_MODULE_INIT:
|
|
||||||
return B_OK;
|
|
||||||
case B_MODULE_UNINIT:
|
|
||||||
return B_OK;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return B_ERROR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
module_dependency module_dependencies[] = {
|
module_dependency module_dependencies[] = {
|
||||||
{ IDE_FOR_CONTROLLER_MODULE_NAME, (module_info **)&ide },
|
{ IDE_FOR_CONTROLLER_MODULE_NAME, (module_info **)&ide },
|
||||||
{ B_DEVICE_MANAGER_MODULE_NAME, (module_info **)&dm },
|
{ B_DEVICE_MANAGER_MODULE_NAME, (module_info **)&dm },
|
||||||
@@ -383,7 +348,7 @@ static ide_controller_interface channel_interface = {
|
|||||||
{
|
{
|
||||||
CHANNEL_MODULE_NAME,
|
CHANNEL_MODULE_NAME,
|
||||||
0,
|
0,
|
||||||
std_ops
|
NULL
|
||||||
},
|
},
|
||||||
|
|
||||||
.supports_device = NULL,
|
.supports_device = NULL,
|
||||||
@@ -391,8 +356,6 @@ static ide_controller_interface channel_interface = {
|
|||||||
.init_driver = channel_init,
|
.init_driver = channel_init,
|
||||||
.uninit_driver = channel_uninit,
|
.uninit_driver = channel_uninit,
|
||||||
.device_removed = channel_removed,
|
.device_removed = channel_removed,
|
||||||
.device_cleanup = NULL,
|
|
||||||
.get_supported_paths = NULL,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
.write_command_block_regs = task_file_write,
|
.write_command_block_regs = task_file_write,
|
||||||
@@ -411,16 +374,14 @@ static driver_module_info controller_interface = {
|
|||||||
{
|
{
|
||||||
CONTROLLER_MODULE_NAME,
|
CONTROLLER_MODULE_NAME,
|
||||||
0,
|
0,
|
||||||
std_ops
|
NULL
|
||||||
},
|
},
|
||||||
|
|
||||||
.supports_device = controller_supports,
|
|
||||||
.register_device = controller_probe,
|
|
||||||
.init_driver = controller_init,
|
.init_driver = controller_init,
|
||||||
.uninit_driver = controller_uninit,
|
.uninit_driver = controller_uninit,
|
||||||
|
.supports_device = controller_supports,
|
||||||
|
.register_device = controller_probe,
|
||||||
.device_removed = controller_removed,
|
.device_removed = controller_removed,
|
||||||
.device_cleanup = NULL,
|
|
||||||
.get_supported_paths = controller_get_paths,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module_info *modules[] = {
|
module_info *modules[] = {
|
||||||
|
|||||||
Reference in New Issue
Block a user