I am trying to help a bit with the transition from IDE to ATA stack.

* Copied ide_adapter.h as ata_adapter.h in attempt to further
  separate the two stacks.
* Continued renaming stuff in drivers/bus/ATA.h
* Make all the busses/ata drivers include the new headers,
  specifically ata_types.h, ata_adapter.h and bus/ATA.h,
  they were all including ide_types and bus/IDE.h still
* Some renaming of global variables for coding style consistency
* Removed the promise driver from the build, it's not used on the
  image and I don't believe it compiled even for the old IDE stack.
* There is no more Command Queueing in the new ATA stack, so I
  removed the capability indication from the busses/ata drivers
  and ata_adapter.h.

The new ATA stack still boots fine on my computer and I proof-read
the diff like two times. Basically, this was a careful search&replace
job only. The only things I am not sure about is renaming some
publishing related strings, but it seems to all work fine.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30700 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2009-05-10 17:04:04 +00:00
parent 8365643720
commit 7f33d2c159
10 changed files with 603 additions and 406 deletions

View File

@ -25,7 +25,7 @@ union ata_task_file;
typedef unsigned int ata_reg_mask;
// channel cookie, issued by ata bus manager
typedef void *ata_channel;
typedef void* ata_channel;
// interface of controller driver
typedef struct {

View File

@ -0,0 +1,208 @@
/*
* Copyright 2005-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Copyright 2002-04, Thomas Kurschel. All rights reserved.
*
* Distributed under the terms of the MIT License.
*/
#ifndef _ATA_PCI_H
#define _ATA_PCI_H
/*
ATA adapter library
Module to simplify writing an ATA adapter driver.
The interface is not very abstract, i.e. the actual driver is
free to access any controller or channel data of this library.
*/
#include <bus/ATA.h>
#include <bus/PCI.h>
#include <ata_types.h>
// one Physical Region Descriptor (PRD)
// (one region must not cross 64K boundary;
// the PRD table must not cross a 64K boundary)
typedef struct prd_entry {
uint32 address; // physical address of block (must be even)
uint16 count; // size of block, 0 stands for 65536 (must be even)
uint8 res6;
LBITFIELD8_2(
res7_0 : 7,
EOT : 1 // 1 for last entry
);
} prd_entry;
// IDE bus master command register
#define ATA_BM_COMMAND_START_STOP 0x01
#define ATA_BM_COMMAND_READ_FROM_DEVICE 0x08
// IDE bus master status register
#define ATA_BM_STATUS_ACTIVE 0x01
#define ATA_BM_STATUS_ERROR 0x02
#define ATA_BM_STATUS_INTERRUPT 0x04
#define ATA_BM_STATUS_MASTER_DMA 0x20
#define ATA_BM_STATUS_SLAVE_DMA 0x40
#define ATA_BM_STATUS_SIMPLEX_DMA 0x80
// offset of bus master registers
enum {
ATA_BM_COMMAND_REG = 0,
ATA_BM_STATUS_REG = 2,
ATA_BM_PRDT_ADDRESS = 4
// offset of PRDT register; content must be dword-aligned
};
// bit mask in class_api of PCI configuration
// (for adapters that can run in compatability mode)
enum {
ATA_API_PRIMARY_NATIVE = 1, // primary channel is in native mode
ATA_API_PRIMARY_FIXED = 2, // primary channel can be switched to native mode
ATA_API_SECONDARY_NATIVE = 4, // secondary channel is in native mode
ATA_API_SECONDARY_FIXED = 8 // secondary channel can be switched to native mode
};
// (maximum) size of S/G table
// there are so many restrictions that we want to keep it inside one page
// to be sure that we fulfill them all
#define ATA_ADAPTER_MAX_SG_COUNT (B_PAGE_SIZE / sizeof( prd_entry ))
// channel node items
// io address of command block (uint16)
#define ATA_ADAPTER_COMMAND_BLOCK_BASE "ata_adapter/command_block_base"
// io address of control block (uint16)
#define ATA_ADAPTER_CONTROL_BLOCK_BASE "ata_adapter/control_block_base"
// interrupt number (uint8)
// can also be defined in controller node if both channels use same IRQ!
#define ATA_ADAPTER_INTNUM "ata_adapter/irq"
// 0 if primary channel, 1 if secondary channel, 2 if tertiary, ... (uint8)
#define ATA_ADAPTER_CHANNEL_INDEX "ata_adapter/channel_index"
// controller node items
// io address of bus master registers (uint16)
#define ATA_ADAPTER_BUS_MASTER_BASE "ata_adapter/bus_master_base"
// info about one channel
typedef struct ata_adapter_channel_info {
pci_device_module_info *pci;
pci_device *device;
uint16 command_block_base; // io address command block
uint16 control_block_base; // io address control block
uint16 bus_master_base;
int intnum; // interrupt number
uint32 lost; // != 0 if device got removed, i.e. if it must not
// be accessed anymore
ata_channel ataChannel;
device_node *node;
int32 (*inthand)( void *arg );
area_id prd_area;
prd_entry *prdt;
uint32 prdt_phys;
uint32 dmaing;
} ata_adapter_channel_info;
// info about controller
typedef struct ata_adapter_controller_info {
pci_device_module_info *pci;
pci_device *device;
uint16 bus_master_base;
uint32 lost; // != 0 if device got removed, i.e. if it must not
// be accessed anymore
device_node *node;
} ata_adapter_controller_info;
// interface of IDE adapter library
typedef struct {
module_info info;
void (*set_channel)(ata_adapter_channel_info *channel,
ata_channel ataChannel);
// function calls that can be forwarded from actual driver
status_t (*write_command_block_regs)(ata_adapter_channel_info *channel,
ata_task_file *tf, ata_reg_mask mask);
status_t (*read_command_block_regs)(ata_adapter_channel_info *channel,
ata_task_file *tf, ata_reg_mask mask);
uint8 (*get_altstatus) (ata_adapter_channel_info *channel);
status_t (*write_device_control) (ata_adapter_channel_info *channel, uint8 val);
status_t (*write_pio)(ata_adapter_channel_info *channel, uint16 *data, int count, bool force_16bit);
status_t (*read_pio)(ata_adapter_channel_info *channel, uint16 *data, int count, bool force_16bit);
status_t (*prepare_dma)(ata_adapter_channel_info *channel, const physical_entry *sg_list,
size_t sg_list_count, bool to_device);
status_t (*start_dma)(ata_adapter_channel_info *channel);
status_t (*finish_dma)(ata_adapter_channel_info *channel);
// default functions that should be replaced by a more specific version
// (copy them from source code of this library and modify them at will)
int32 (*inthand)(void *arg);
// functions that must be called by init/uninit etc. of channel driver
status_t (*init_channel)(device_node *node,
ata_adapter_channel_info **cookie, size_t total_data_size,
int32 (*inthand)(void *arg));
void (*uninit_channel)(ata_adapter_channel_info *channel);
void (*channel_removed)(ata_adapter_channel_info *channel);
// publish channel node
status_t (*publish_channel)(device_node *controller_node,
const char *channel_module_name, uint16 command_block_base,
uint16 control_block_base, uint8 intnum, bool can_dma,
uint8 channel_index, const char *name,
const io_resource *resources, device_node **node);
// verify channel configuration and publish node on success
status_t (*detect_channel)(pci_device_module_info *pci, pci_device *pciDevice,
device_node *controller_node, const char *channel_module_name,
bool controller_can_dma, uint16 command_block_base,
uint16 control_block_base, uint16 bus_master_base,
uint8 intnum, uint8 channel_index, const char *name,
device_node **node, bool supports_compatibility_mode);
// functions that must be called by init/uninit etc. of controller driver
status_t (*init_controller)(device_node *node,
ata_adapter_controller_info **cookie, size_t total_data_size);
void (*uninit_controller)(ata_adapter_controller_info *controller);
void (*controller_removed)(ata_adapter_controller_info *controller);
// publish controller node
status_t (*publish_controller)(device_node *parent, uint16 bus_master_base,
io_resource *resources, const char *controller_driver,
const char *controller_driver_type, const char *controller_name,
bool can_dma, bool can_cq, uint32 dma_alignment, uint32 dma_boundary,
uint32 max_sg_block_size, device_node **node);
// verify controller configuration and publish node on success
status_t (*detect_controller)(pci_device_module_info *pci, pci_device *pciDevice,
device_node *parent, uint16 bus_master_base,
const char *controller_driver, const char *controller_driver_type,
const char *controller_name, bool can_dma, bool can_cq,
uint32 dma_alignment, uint32 dma_boundary, uint32 max_sg_block_size,
device_node **node);
// standard master probe for controller that registers controller and channel nodes
status_t (*probe_controller)(device_node *parent, const char *controller_driver,
const char *controller_driver_type, const char *controller_name,
const char *channel_module_name, bool can_dma, bool can_cq,
uint32 dma_alignment, uint32 dma_boundary, uint32 max_sg_block_size,
bool supports_compatibility_mode);
} ata_adapter_interface;
#define ATA_ADAPTER_MODULE_NAME "generic/ata_adapter/v1"
#endif /* _ATA_PCI_H */

View File

@ -3,6 +3,6 @@ SubDir HAIKU_TOP src add-ons kernel busses ata ;
SubInclude HAIKU_TOP src add-ons kernel busses ata generic_ide_pci ;
SubInclude HAIKU_TOP src add-ons kernel busses ata ide_isa ;
SubInclude HAIKU_TOP src add-ons kernel busses ata it8211 ;
SubInclude HAIKU_TOP src add-ons kernel busses ata promise_tx2 ;
#SubInclude HAIKU_TOP src add-ons kernel busses ata promise_tx2 ;
SubInclude HAIKU_TOP src add-ons kernel busses ata silicon_image_3112 ;
SubInclude HAIKU_TOP src add-ons kernel busses ata legacy_sata ;

View File

@ -9,64 +9,64 @@
#include <stdlib.h>
#include <string.h>
#include <ide_adapter.h>
#include <ata_adapter.h>
#define GENERIC_IDE_PCI_CONTROLLER_MODULE_NAME "busses/ata/generic_ide_pci/driver_v1"
#define GENERIC_IDE_PCI_CHANNEL_MODULE_NAME "busses/ata/generic_ide_pci/channel/v1"
#define IDE_PCI_CONTROLLER_TYPE_NAME "ide pci controller"
#define ATA_PCI_CONTROLLER_TYPE_NAME "ata pci controller"
ide_for_controller_interface *ide;
static ide_adapter_interface *ide_adapter;
device_manager_info *pnp;
ata_for_controller_interface *sATA;
static ata_adapter_interface *sATAAdapter;
device_manager_info *sDeviceManager;
static void
set_channel(void *cookie, ide_channel channel)
set_channel(void *cookie, ata_channel channel)
{
ide_adapter->set_channel((ide_adapter_channel_info *)cookie, channel);
sATAAdapter->set_channel((ata_adapter_channel_info *)cookie, channel);
}
static status_t
write_command_block_regs(void *channel_cookie, ide_task_file *tf, ide_reg_mask mask)
write_command_block_regs(void *channel_cookie, ata_task_file *tf, ata_reg_mask mask)
{
return ide_adapter->write_command_block_regs((ide_adapter_channel_info *)channel_cookie, tf, mask);
return sATAAdapter->write_command_block_regs((ata_adapter_channel_info *)channel_cookie, tf, mask);
}
static status_t
read_command_block_regs(void *channel_cookie, ide_task_file *tf, ide_reg_mask mask)
read_command_block_regs(void *channel_cookie, ata_task_file *tf, ata_reg_mask mask)
{
return ide_adapter->read_command_block_regs((ide_adapter_channel_info *)channel_cookie, tf, mask);
return sATAAdapter->read_command_block_regs((ata_adapter_channel_info *)channel_cookie, tf, mask);
}
static uint8
get_altstatus(void *channel_cookie)
{
return ide_adapter->get_altstatus((ide_adapter_channel_info *)channel_cookie);
return sATAAdapter->get_altstatus((ata_adapter_channel_info *)channel_cookie);
}
static status_t
write_device_control(void *channel_cookie, uint8 val)
{
return ide_adapter->write_device_control((ide_adapter_channel_info *)channel_cookie, val);
return sATAAdapter->write_device_control((ata_adapter_channel_info *)channel_cookie, val);
}
static status_t
write_pio(void *channel_cookie, uint16 *data, int count, bool force_16bit)
{
return ide_adapter->write_pio((ide_adapter_channel_info *)channel_cookie, data, count, force_16bit);
return sATAAdapter->write_pio((ata_adapter_channel_info *)channel_cookie, data, count, force_16bit);
}
static status_t
read_pio(void *channel_cookie, uint16 *data, int count, bool force_16bit)
{
return ide_adapter->read_pio((ide_adapter_channel_info *)channel_cookie, data, count, force_16bit);
return sATAAdapter->read_pio((ata_adapter_channel_info *)channel_cookie, data, count, force_16bit);
}
@ -75,73 +75,73 @@ prepare_dma(void *channel_cookie,
const physical_entry *sg_list, size_t sg_list_count,
bool to_device)
{
return ide_adapter->prepare_dma((ide_adapter_channel_info *)channel_cookie, sg_list, sg_list_count, to_device);
return sATAAdapter->prepare_dma((ata_adapter_channel_info *)channel_cookie, sg_list, sg_list_count, to_device);
}
static status_t
start_dma(void *channel_cookie)
{
return ide_adapter->start_dma((ide_adapter_channel_info *)channel_cookie);
return sATAAdapter->start_dma((ata_adapter_channel_info *)channel_cookie);
}
static status_t
finish_dma(void *channel_cookie)
{
return ide_adapter->finish_dma((ide_adapter_channel_info *)channel_cookie);
return sATAAdapter->finish_dma((ata_adapter_channel_info *)channel_cookie);
}
static status_t
init_channel(device_node *node, void **channel_cookie)
{
return ide_adapter->init_channel(node,
(ide_adapter_channel_info **)channel_cookie,
sizeof(ide_adapter_channel_info), ide_adapter->inthand);
return sATAAdapter->init_channel(node,
(ata_adapter_channel_info **)channel_cookie,
sizeof(ata_adapter_channel_info), sATAAdapter->inthand);
}
static void
uninit_channel(void *channel_cookie)
{
ide_adapter->uninit_channel((ide_adapter_channel_info *)channel_cookie);
sATAAdapter->uninit_channel((ata_adapter_channel_info *)channel_cookie);
}
static void
channel_removed(void *channel_cookie)
{
ide_adapter->channel_removed((ide_adapter_channel_info *)channel_cookie);
sATAAdapter->channel_removed((ata_adapter_channel_info *)channel_cookie);
}
static status_t
init_controller(device_node *node, ide_adapter_controller_info **cookie)
init_controller(device_node *node, ata_adapter_controller_info **cookie)
{
return ide_adapter->init_controller(node, cookie,
sizeof( ide_adapter_controller_info));
return sATAAdapter->init_controller(node, cookie,
sizeof( ata_adapter_controller_info));
}
static void
uninit_controller(ide_adapter_controller_info *controller)
uninit_controller(ata_adapter_controller_info *controller)
{
ide_adapter->uninit_controller(controller);
sATAAdapter->uninit_controller(controller);
}
static void
controller_removed(ide_adapter_controller_info *controller)
controller_removed(ata_adapter_controller_info *controller)
{
return ide_adapter->controller_removed(controller);
return sATAAdapter->controller_removed(controller);
}
static status_t
probe_controller(device_node *parent)
{
return ide_adapter->probe_controller(parent,
return sATAAdapter->probe_controller(parent,
GENERIC_IDE_PCI_CONTROLLER_MODULE_NAME, "generic_ide_pci",
"Generic IDE PCI Controller",
GENERIC_IDE_PCI_CHANNEL_MODULE_NAME,
@ -161,9 +161,9 @@ supports_device(device_node *parent)
uint16 baseClass, subClass;
// make sure parent is an PCI IDE mass storage host adapter device node
if (pnp->get_attr_string(parent, B_DEVICE_BUS, &bus, false) != B_OK
|| pnp->get_attr_uint16(parent, B_DEVICE_TYPE, &baseClass, false) != B_OK
|| pnp->get_attr_uint16(parent, B_DEVICE_SUB_TYPE, &subClass, false) != B_OK)
if (sDeviceManager->get_attr_string(parent, B_DEVICE_BUS, &bus, false) != B_OK
|| sDeviceManager->get_attr_uint16(parent, B_DEVICE_TYPE, &baseClass, false) != B_OK
|| sDeviceManager->get_attr_uint16(parent, B_DEVICE_SUB_TYPE, &subClass, false) != B_OK)
return -1;
if (strcmp(bus, "pci") || baseClass != PCI_mass_storage)
@ -182,15 +182,15 @@ supports_device(device_node *parent)
module_dependency module_dependencies[] = {
{ IDE_FOR_CONTROLLER_MODULE_NAME, (module_info **)&ide },
{ B_DEVICE_MANAGER_MODULE_NAME, (module_info **)&pnp },
{ IDE_ADAPTER_MODULE_NAME, (module_info **)&ide_adapter },
{ ATA_FOR_CONTROLLER_MODULE_NAME, (module_info **)&sATA },
{ B_DEVICE_MANAGER_MODULE_NAME, (module_info **)&sDeviceManager },
{ ATA_ADAPTER_MODULE_NAME, (module_info **)&sATAAdapter },
{}
};
// exported interface
static ide_controller_interface channel_interface = {
static ata_controller_interface channel_interface = {
{
{
GENERIC_IDE_PCI_CHANNEL_MODULE_NAME,

View File

@ -16,10 +16,8 @@
#include <stdlib.h>
#include <string.h>
#include <ata_adapter.h>
#include <bus/ISA.h>
#include <bus/IDE.h>
#include <ide_types.h>
#include <device_manager.h>
//#define TRACE_IDE_ISA
@ -30,19 +28,19 @@
#endif
#define IDE_ISA_MODULE_NAME "busses/ata/ide_isa/driver_v1"
#define ATA_ISA_MODULE_NAME "busses/ata/ide_isa/driver_v1"
// private node item:
// io address of command block
#define IDE_ISA_COMMAND_BLOCK_BASE "ide_isa/command_block_base"
#define ATA_ISA_COMMAND_BLOCK_BASE "ide_isa/command_block_base"
// io address of control block
#define IDE_ISA_CONTROL_BLOCK_BASE "ide_isa/control_block_base"
#define ATA_ISA_CONTROL_BLOCK_BASE "ide_isa/control_block_base"
// interrupt number
#define IDE_ISA_INTNUM "ide_isa/irq"
#define ATA_ISA_INTNUM "ide_isa/irq"
ide_for_controller_interface *ide;
device_manager_info *pnp;
ata_for_controller_interface *sATA;
device_manager_info *sDeviceManager;
// info about one channel
@ -55,34 +53,33 @@ typedef struct channel_info {
uint32 lost; // != 0 if device got removed, i.e. if it must not
// be accessed anymore
ide_channel ide_channel;
ata_channel ataChannel;
device_node *node;
} channel_info;
/*! publish node of an ide channel */
/*! publish node of an ata channel */
static status_t
publish_channel(device_node *parent, uint16 command_block_base,
uint16 control_block_base, uint8 intnum, const char *name)
{
device_attr attrs[] = {
{ B_DEVICE_FIXED_CHILD, B_STRING_TYPE, { string: IDE_FOR_CONTROLLER_MODULE_NAME }},
{ B_DEVICE_FIXED_CHILD, B_STRING_TYPE, { string: ATA_FOR_CONTROLLER_MODULE_NAME }},
// properties of this controller for ide bus manager
{ IDE_CONTROLLER_MAX_DEVICES_ITEM, B_UINT8_TYPE, { ui8: 2 }},
{ IDE_CONTROLLER_CAN_DMA_ITEM, B_UINT8_TYPE, { ui8: 0 }},
{ IDE_CONTROLLER_CAN_CQ_ITEM, B_UINT8_TYPE, { ui8: 1 }},
{ IDE_CONTROLLER_CONTROLLER_NAME_ITEM, B_STRING_TYPE, { string: name }},
// properties of this controller for ata bus manager
{ ATA_CONTROLLER_MAX_DEVICES_ITEM, B_UINT8_TYPE, { ui8: 2 }},
{ ATA_CONTROLLER_CAN_DMA_ITEM, B_UINT8_TYPE, { ui8: 0 }},
{ ATA_CONTROLLER_CONTROLLER_NAME_ITEM, B_STRING_TYPE, { string: name }},
// DMA properties; the 16 bit alignment is not necessary as
// the ide bus manager handles that very efficiently, but why
// the ata bus manager handles that very efficiently, but why
// not use the block device manager for doing that?
{ B_DMA_ALIGNMENT, B_UINT32_TYPE, { ui32: 1 }},
// private data to identify device
{ IDE_ISA_COMMAND_BLOCK_BASE, B_UINT16_TYPE, { ui16: command_block_base }},
{ IDE_ISA_CONTROL_BLOCK_BASE, B_UINT16_TYPE, { ui16: control_block_base }},
{ IDE_ISA_INTNUM, B_UINT8_TYPE, { ui8: intnum }},
{ ATA_ISA_COMMAND_BLOCK_BASE, B_UINT16_TYPE, { ui16: command_block_base }},
{ ATA_ISA_CONTROL_BLOCK_BASE, B_UINT16_TYPE, { ui16: control_block_base }},
{ ATA_ISA_INTNUM, B_UINT8_TYPE, { ui8: intnum }},
{ NULL }
};
io_resource resources[3] = {
@ -94,7 +91,7 @@ publish_channel(device_node *parent, uint16 command_block_base,
TRACE("publishing %s, resources %#x %#x %d\n",
name, command_block_base, control_block_base, intnum);
return pnp->register_node(parent, IDE_ISA_MODULE_NAME, attrs, resources,
return sDeviceManager->register_node(parent, ATA_ISA_MODULE_NAME, attrs, resources,
NULL);
}
@ -103,16 +100,16 @@ publish_channel(device_node *parent, uint16 command_block_base,
static void
set_channel(void *cookie, ide_channel ideChannel)
set_channel(void *cookie, ata_channel ataChannel)
{
channel_info *channel = cookie;
channel->ide_channel = ideChannel;
channel->ataChannel = ataChannel;
}
static status_t
write_command_block_regs(void *channel_cookie, ide_task_file *tf,
ide_reg_mask mask)
write_command_block_regs(void *channel_cookie, ata_task_file *tf,
ata_reg_mask mask)
{
channel_info *channel = channel_cookie;
uint16 ioaddr = channel->command_block_base;
@ -139,8 +136,8 @@ write_command_block_regs(void *channel_cookie, ide_task_file *tf,
static status_t
read_command_block_regs(void *channel_cookie, ide_task_file *tf,
ide_reg_mask mask)
read_command_block_regs(void *channel_cookie, ata_task_file *tf,
ata_reg_mask mask)
{
channel_info *channel = channel_cookie;
uint16 ioaddr = channel->command_block_base;
@ -256,7 +253,7 @@ inthand(void *arg)
// acknowledge IRQ
status = channel->isa->read_io_8(channel->command_block_base + 7);
return ide->irq_handler(channel->ide_channel, status);
return sATA->interrupt_handler(channel->ataChannel, status);
}
@ -291,7 +288,7 @@ supports_device(device_node *parent)
const char *bus;
// make sure parent is really the ISA bus manager
if (pnp->get_attr_string(parent, B_DEVICE_BUS, &bus, false))
if (sDeviceManager->get_attr_string(parent, B_DEVICE_BUS, &bus, false))
return B_ERROR;
if (strcmp(bus, "isa"))
@ -318,14 +315,14 @@ init_channel(device_node *node, void **_cookie)
TRACE("ISA-IDE: channel init\n");
// get device data
if (pnp->get_attr_uint16(node, IDE_ISA_COMMAND_BLOCK_BASE, &command_block_base, false) != B_OK
|| pnp->get_attr_uint16(node, IDE_ISA_CONTROL_BLOCK_BASE, &control_block_base, false) != B_OK
|| pnp->get_attr_uint8(node, IDE_ISA_INTNUM, &irq, false) != B_OK)
if (sDeviceManager->get_attr_uint16(node, ATA_ISA_COMMAND_BLOCK_BASE, &command_block_base, false) != B_OK
|| sDeviceManager->get_attr_uint16(node, ATA_ISA_CONTROL_BLOCK_BASE, &control_block_base, false) != B_OK
|| sDeviceManager->get_attr_uint8(node, ATA_ISA_INTNUM, &irq, false) != B_OK)
return B_ERROR;
parent = pnp->get_parent_node(node);
pnp->get_driver(parent, (driver_module_info **)&isa, NULL);
pnp->put_node(parent);
parent = sDeviceManager->get_parent_node(node);
sDeviceManager->get_driver(parent, (driver_module_info **)&isa, NULL);
sDeviceManager->put_node(parent);
channel = (channel_info *)malloc(sizeof(channel_info));
if (channel == NULL)
@ -340,7 +337,7 @@ init_channel(device_node *node, void **_cookie)
channel->command_block_base = command_block_base;
channel->control_block_base = control_block_base;
channel->intnum = irq;
channel->ide_channel = NULL;
channel->ataChannel = NULL;
res = install_io_interrupt_handler(channel->intnum,
inthand, channel, 0);
@ -351,7 +348,7 @@ init_channel(device_node *node, void **_cookie)
}
// enable interrupts so the channel is ready to run
write_device_control(channel, ide_devctrl_bit3);
write_device_control(channel, ATA_DEVICE_CONTROL_BIT3);
*_cookie = channel;
return B_OK;
@ -370,7 +367,7 @@ uninit_channel(void *channel_cookie)
TRACE("ISA-IDE: channel uninit\n");
// disable IRQs
write_device_control(channel, ide_devctrl_bit3 | ide_devctrl_nien);
write_device_control(channel, ATA_DEVICE_CONTROL_BIT3 | ATA_DEVICE_CONTROL_DISABLE_INTS);
// catch spurious interrupt
// (some controllers generate an IRQ when you _disable_ interrupts,
@ -416,16 +413,16 @@ channel_removed(void *cookie)
module_dependency module_dependencies[] = {
{ IDE_FOR_CONTROLLER_MODULE_NAME, (module_info **)&ide },
{ B_DEVICE_MANAGER_MODULE_NAME, (module_info **)&pnp },
{ ATA_FOR_CONTROLLER_MODULE_NAME, (module_info **)&sATA },
{ B_DEVICE_MANAGER_MODULE_NAME, (module_info **)&sDeviceManager },
{}
};
// exported interface
static ide_controller_interface sISAControllerInterface = {
static ata_controller_interface sISAControllerInterface = {
{
{
IDE_ISA_MODULE_NAME,
ATA_ISA_MODULE_NAME,
0,
NULL
},

View File

@ -6,7 +6,7 @@
#include <stdlib.h>
#include <string.h>
#include <ide_adapter.h>
#include <ata_adapter.h>
#define IT8211_CONTROLLER_MODULE_NAME "busses/ata/it8211/driver_v1"
#define IT8211_CHANNEL_MODULE_NAME "busses/ata/it8211/channel/v1"
@ -14,64 +14,64 @@
#define PCI_VENDOR_ITE 0x1283
#define PCI_DEVICE_ITE_IT8211 0x8211
static ide_adapter_interface *sIDEAdapter;
static ata_adapter_interface *sATAAdapter;
static device_manager_info *sDeviceManager;
static void
it8211_set_channel(void *channelCookie, ide_channel channel)
it8211_set_channel(void *channelCookie, ata_channel channel)
{
sIDEAdapter->set_channel((ide_adapter_channel_info *)channelCookie,
sATAAdapter->set_channel((ata_adapter_channel_info *)channelCookie,
channel);
}
static status_t
it8211_write_command_block_regs(void *channelCookie, ide_task_file *taskFile,
ide_reg_mask registerMask)
it8211_write_command_block_regs(void *channelCookie, ata_task_file *taskFile,
ata_reg_mask registerMask)
{
return sIDEAdapter->write_command_block_regs(
(ide_adapter_channel_info *)channelCookie, taskFile, registerMask);
return sATAAdapter->write_command_block_regs(
(ata_adapter_channel_info *)channelCookie, taskFile, registerMask);
}
static status_t
it8211_read_command_block_regs(void *channelCookie, ide_task_file *taskFile,
ide_reg_mask registerMask)
it8211_read_command_block_regs(void *channelCookie, ata_task_file *taskFile,
ata_reg_mask registerMask)
{
return sIDEAdapter->read_command_block_regs(
(ide_adapter_channel_info *)channelCookie, taskFile, registerMask);
return sATAAdapter->read_command_block_regs(
(ata_adapter_channel_info *)channelCookie, taskFile, registerMask);
}
static uint8
it8211_get_altstatus(void *channelCookie)
{
return sIDEAdapter->get_altstatus((ide_adapter_channel_info *)channelCookie);
return sATAAdapter->get_altstatus((ata_adapter_channel_info *)channelCookie);
}
static status_t
it8211_write_device_control(void *channelCookie, uint8 value)
{
return sIDEAdapter->write_device_control(
(ide_adapter_channel_info *)channelCookie, value);
return sATAAdapter->write_device_control(
(ata_adapter_channel_info *)channelCookie, value);
}
static status_t
it8211_write_pio(void *channelCookie, uint16 *data, int count, bool force16bit)
{
return sIDEAdapter->write_pio(
(ide_adapter_channel_info *)channelCookie, data, count, force16bit);
return sATAAdapter->write_pio(
(ata_adapter_channel_info *)channelCookie, data, count, force16bit);
}
static status_t
it8211_read_pio(void *channelCookie, uint16 *data, int count, bool force16bit)
{
return sIDEAdapter->read_pio(
(ide_adapter_channel_info *)channelCookie, data, count, force16bit);
return sATAAdapter->read_pio(
(ata_adapter_channel_info *)channelCookie, data, count, force16bit);
}
@ -79,7 +79,7 @@ static status_t
it8211_prepare_dma(void *channelCookie, const physical_entry *sgList,
size_t sgListCount, bool toDevice)
{
return sIDEAdapter->prepare_dma((ide_adapter_channel_info *)channelCookie,
return sATAAdapter->prepare_dma((ata_adapter_channel_info *)channelCookie,
sgList, sgListCount, toDevice);
}
@ -87,67 +87,67 @@ it8211_prepare_dma(void *channelCookie, const physical_entry *sgList,
static status_t
it8211_start_dma(void *channelCookie)
{
return sIDEAdapter->start_dma((ide_adapter_channel_info *)channelCookie);
return sATAAdapter->start_dma((ata_adapter_channel_info *)channelCookie);
}
static status_t
it8211_finish_dma(void *channelCookie)
{
return sIDEAdapter->finish_dma((ide_adapter_channel_info *)channelCookie);
return sATAAdapter->finish_dma((ata_adapter_channel_info *)channelCookie);
}
static status_t
init_channel(device_node *node, void **channelCookie)
{
return sIDEAdapter->init_channel(node,
(ide_adapter_channel_info **)channelCookie,
sizeof(ide_adapter_channel_info), sIDEAdapter->inthand);
return sATAAdapter->init_channel(node,
(ata_adapter_channel_info **)channelCookie,
sizeof(ata_adapter_channel_info), sATAAdapter->inthand);
}
static void
uninit_channel(void *channelCookie)
{
sIDEAdapter->uninit_channel((ide_adapter_channel_info *)channelCookie);
sATAAdapter->uninit_channel((ata_adapter_channel_info *)channelCookie);
}
static void
channel_removed(void *channelCookie)
{
sIDEAdapter->channel_removed((ide_adapter_channel_info *)channelCookie);
sATAAdapter->channel_removed((ata_adapter_channel_info *)channelCookie);
}
static status_t
init_controller(device_node *node, void **cookie)
{
return sIDEAdapter->init_controller(node,
(ide_adapter_controller_info **)cookie,
sizeof(ide_adapter_controller_info));
return sATAAdapter->init_controller(node,
(ata_adapter_controller_info **)cookie,
sizeof(ata_adapter_controller_info));
}
static void
uninit_controller(void *cookie)
{
sIDEAdapter->uninit_controller((ide_adapter_controller_info *)cookie);
sATAAdapter->uninit_controller((ata_adapter_controller_info *)cookie);
}
static void
controller_removed(void *cookie)
{
sIDEAdapter->controller_removed((ide_adapter_controller_info *)cookie);
sATAAdapter->controller_removed((ata_adapter_controller_info *)cookie);
}
static status_t
probe_controller(device_node *parent)
{
return sIDEAdapter->probe_controller(parent,
return sATAAdapter->probe_controller(parent,
IT8211_CONTROLLER_MODULE_NAME, "it8211",
"ITE IT8211", IT8211_CHANNEL_MODULE_NAME,
true, /* DMA */
@ -182,13 +182,13 @@ supports_device(device_node *parent)
module_dependency module_dependencies[] = {
{ B_DEVICE_MANAGER_MODULE_NAME, (module_info **)&sDeviceManager },
{ IDE_ADAPTER_MODULE_NAME, (module_info **)&sIDEAdapter },
{ ATA_ADAPTER_MODULE_NAME, (module_info **)&sATAAdapter },
{}
};
// exported interface
static ide_controller_interface sChannelInterface = {
static ata_controller_interface sChannelInterface = {
{
{
IT8211_CHANNEL_MODULE_NAME,

View File

@ -6,15 +6,13 @@
#include <KernelExport.h>
#include <stdlib.h>
#include <string.h>
#include <device_manager.h>
#include <bus/IDE.h>
#include <ide_adapter.h>
#include <ata_adapter.h>
#define DRIVER_PRETTY_NAME "Legacy SATA"
#define CONTROLLER_NAME DRIVER_PRETTY_NAME
#define CONTROLLER_MODULE_NAME "busses/ata/legacy_sata/driver_v1"
#define CHANNEL_MODULE_NAME "busses/ide/legacy_sata/channel/v1"
#define CHANNEL_MODULE_NAME "busses/ata/legacy_sata/channel/v1"
#define TRACE(a...) dprintf(DRIVER_PRETTY_NAME ": " a)
#define FLOW(a...) dprintf(DRIVER_PRETTY_NAME ": " a)
@ -55,9 +53,9 @@ static const char * const kChannelNames[] = {
"Tertiary Channel", "Quaternary Channel"
};
static ide_for_controller_interface* ide;
static ide_adapter_interface* ide_adapter;
static device_manager_info* dm;
static ata_for_controller_interface* sATA;
static ata_adapter_interface* sATAAdapter;
static device_manager_info* sDeviceManager;
static float
@ -69,15 +67,15 @@ controller_supports(device_node *parent)
const char *bus = NULL;
// get the bus (should be PCI)
if (dm->get_attr_string(parent, B_DEVICE_BUS, &bus, false) != B_OK)
if (sDeviceManager->get_attr_string(parent, B_DEVICE_BUS, &bus, false) != B_OK)
return B_ERROR;
if (strcmp(bus, "pci") != 0) {
return B_ERROR;
}
// get vendor and device ID
if ((res=dm->get_attr_uint16(parent, B_DEVICE_VENDOR_ID, &vendor_id, false)) != B_OK
|| (res=dm->get_attr_uint16(parent, B_DEVICE_ID, &device_id, false)) != B_OK) {
if ((res = sDeviceManager->get_attr_uint16(parent, B_DEVICE_VENDOR_ID, &vendor_id, false)) != B_OK
|| (res = sDeviceManager->get_attr_uint16(parent, B_DEVICE_ID, &device_id, false)) != B_OK) {
return res;
}
@ -140,7 +138,7 @@ controller_probe(device_node *parent)
TRACE("controller_probe\n");
dm->get_driver(parent, (driver_module_info **)&pci, (void **)&device);
sDeviceManager->get_driver(parent, (driver_module_info **)&pci, (void **)&device);
device_id = pci->read_pci_config(device, PCI_device_id, 2);
vendor_id = pci->read_pci_config(device, PCI_vendor_id, 2);
@ -192,7 +190,7 @@ controller_probe(device_node *parent)
control_block_base[index] &= PCI_address_io_mask;
}
res = ide_adapter->detect_controller(pci, device, parent, bus_master_base,
res = sATAAdapter->detect_controller(pci, device, parent, bus_master_base,
CONTROLLER_MODULE_NAME, "" /* XXX: unused: controller_driver_type*/, CONTROLLER_NAME, true,
true, 1, 0xffff, 0x10000, &controller_node);
// don't register if controller is already registered!
@ -207,7 +205,7 @@ controller_probe(device_node *parent)
// ignore errors during registration of channels - could be a simple rescan collision
for (index = 0; index < num_channels; index++) {
res = ide_adapter->detect_channel(pci, device, controller_node, CHANNEL_MODULE_NAME,
res = sATAAdapter->detect_channel(pci, device, controller_node, CHANNEL_MODULE_NAME,
true, command_block_base[index], control_block_base[index], bus_master_base,
int_num, index, kChannelNames[index], &channels[index], false);
@ -227,129 +225,129 @@ err:
static status_t
controller_init(device_node *node, void **controller_cookie)
{
return ide_adapter->init_controller(
node, (ide_adapter_controller_info**)controller_cookie,
sizeof(ide_adapter_controller_info));
return sATAAdapter->init_controller(
node, (ata_adapter_controller_info**)controller_cookie,
sizeof(ata_adapter_controller_info));
}
static void
controller_uninit(void *controller_cookie)
{
ide_adapter->uninit_controller(controller_cookie);
sATAAdapter->uninit_controller(controller_cookie);
}
static void
controller_removed(void *controller_cookie)
{
ide_adapter->controller_removed(
(ide_adapter_controller_info*)controller_cookie);
sATAAdapter->controller_removed(
(ata_adapter_controller_info*)controller_cookie);
}
static status_t
channel_init(device_node *node, void **channel_cookie)
{
return ide_adapter->init_channel(node,
(ide_adapter_channel_info**)channel_cookie,
sizeof(ide_adapter_channel_info),
ide_adapter->inthand);
return sATAAdapter->init_channel(node,
(ata_adapter_channel_info**)channel_cookie,
sizeof(ata_adapter_channel_info),
sATAAdapter->inthand);
}
static void
channel_uninit(void *channel_cookie)
{
ide_adapter->uninit_channel(channel_cookie);
sATAAdapter->uninit_channel(channel_cookie);
}
static void
channel_removed(void *channel_cookie)
{
ide_adapter->channel_removed(channel_cookie);
sATAAdapter->channel_removed(channel_cookie);
}
static void
channel_set(void *cookie, ide_channel channel)
channel_set(void *cookie, ata_channel channel)
{
ide_adapter->set_channel((ide_adapter_channel_info *)cookie, channel);
sATAAdapter->set_channel((ata_adapter_channel_info *)cookie, channel);
}
static status_t
task_file_write(void *channel_cookie, ide_task_file *tf, ide_reg_mask mask)
task_file_write(void *channel_cookie, ata_task_file *tf, ata_reg_mask mask)
{
return ide_adapter->write_command_block_regs(channel_cookie,tf,mask);
return sATAAdapter->write_command_block_regs(channel_cookie,tf,mask);
}
static status_t
task_file_read(void *channel_cookie, ide_task_file *tf, ide_reg_mask mask)
task_file_read(void *channel_cookie, ata_task_file *tf, ata_reg_mask mask)
{
return ide_adapter->read_command_block_regs(channel_cookie,tf,mask);
return sATAAdapter->read_command_block_regs(channel_cookie,tf,mask);
}
static uint8
altstatus_read(void *channel_cookie)
{
return ide_adapter->get_altstatus(channel_cookie);
return sATAAdapter->get_altstatus(channel_cookie);
}
static status_t
device_control_write(void *channel_cookie, uint8 val)
{
return ide_adapter->write_device_control(channel_cookie,val);
return sATAAdapter->write_device_control(channel_cookie,val);
}
static status_t
pio_write(void *channel_cookie, uint16 *data, int count, bool force_16bit)
{
return ide_adapter->write_pio(channel_cookie,data,count,force_16bit);
return sATAAdapter->write_pio(channel_cookie,data,count,force_16bit);
}
static status_t
pio_read(void *channel_cookie, uint16 *data, int count, bool force_16bit)
{
return ide_adapter->read_pio(channel_cookie,data,count,force_16bit);
return sATAAdapter->read_pio(channel_cookie,data,count,force_16bit);
}
static status_t
dma_prepare(void *channel_cookie, const physical_entry *sg_list, size_t sg_list_count, bool write)
{
return ide_adapter->prepare_dma(channel_cookie,sg_list,sg_list_count,write);
return sATAAdapter->prepare_dma(channel_cookie,sg_list,sg_list_count,write);
}
static status_t
dma_start(void *channel_cookie)
{
return ide_adapter->start_dma(channel_cookie);
return sATAAdapter->start_dma(channel_cookie);
}
static status_t
dma_finish(void *channel_cookie)
{
return ide_adapter->finish_dma(channel_cookie);
return sATAAdapter->finish_dma(channel_cookie);
}
module_dependency module_dependencies[] = {
{ IDE_FOR_CONTROLLER_MODULE_NAME, (module_info **)&ide },
{ B_DEVICE_MANAGER_MODULE_NAME, (module_info **)&dm },
{ IDE_ADAPTER_MODULE_NAME, (module_info **)&ide_adapter },
{ ATA_FOR_CONTROLLER_MODULE_NAME, (module_info **)&sATA },
{ B_DEVICE_MANAGER_MODULE_NAME, (module_info **)&sDeviceManager },
{ ATA_ADAPTER_MODULE_NAME, (module_info **)&sATAAdapter },
{}
};
static ide_controller_interface sChannelInterface = {
static ata_controller_interface sChannelInterface = {
{
{
CHANNEL_MODULE_NAME,

View File

@ -11,7 +11,7 @@
#include <stdlib.h>
#include <string.h>
#include <bus/ide/ide_adapter.h>
#include <ata_adapter.h>
#define debug_level_flow 0
#define debug_level_error 3
@ -25,57 +25,57 @@
#define PROMISE_TX2_CHANNEL_MODULE_NAME "busses/ata/promise_tx2/channel/v1"
static ide_for_controller_interface *ide;
static ide_adapter_interface *ide_adapter;
static ata_for_controller_interface *ide;
static ata_adapter_interface *ata_adapter;
static device_manager_info *pnp;
static status_t
write_command_block_regs(void *channel_cookie, ide_task_file *tf, ide_reg_mask mask)
write_command_block_regs(void *channel_cookie, ata_task_file *tf, ata_reg_mask mask)
{
return ide_adapter->write_command_block_regs((ide_adapter_channel_info *)channel_cookie, tf, mask);
return ata_adapter->write_command_block_regs((ata_adapter_channel_info *)channel_cookie, tf, mask);
}
static status_t
read_command_block_regs(void *channel_cookie, ide_task_file *tf, ide_reg_mask mask)
read_command_block_regs(void *channel_cookie, ata_task_file *tf, ata_reg_mask mask)
{
return ide_adapter->read_command_block_regs((ide_adapter_channel_info *)channel_cookie, tf, mask);
return ata_adapter->read_command_block_regs((ata_adapter_channel_info *)channel_cookie, tf, mask);
}
static uint8
get_altstatus(void *channel_cookie)
{
return ide_adapter->get_altstatus((ide_adapter_channel_info *)channel_cookie);
return ata_adapter->get_altstatus((ata_adapter_channel_info *)channel_cookie);
}
static status_t
write_device_control(void *channel_cookie, uint8 val)
{
return ide_adapter->write_device_control((ide_adapter_channel_info *)channel_cookie, val);
return ata_adapter->write_device_control((ata_adapter_channel_info *)channel_cookie, val);
}
static status_t
write_pio(void *channel_cookie, uint16 *data, int count, bool force_16bit)
{
return ide_adapter->write_pio((ide_adapter_channel_info *)channel_cookie, data, count, force_16bit);
return ata_adapter->write_pio((ata_adapter_channel_info *)channel_cookie, data, count, force_16bit);
}
static status_t
read_pio(void *channel_cookie, uint16 *data, int count, bool force_16bit)
{
return ide_adapter->read_pio((ide_adapter_channel_info *)channel_cookie, data, count, force_16bit);
return ata_adapter->read_pio((ata_adapter_channel_info *)channel_cookie, data, count, force_16bit);
}
static int32
inthand(void *arg)
{
ide_adapter_channel_info *channel = (ide_adapter_channel_info *)arg;
ata_adapter_channel_info *channel = (ata_adapter_channel_info *)arg;
pci_device_module_info *pci = channel->pci;
pci_device device = channel->device;
ide_bm_status bm_status;
@ -91,7 +91,7 @@ inthand(void *arg)
if ((pci->read_io_8(device, channel->bus_master_base + 3) & 0x20) == 0)
return B_UNHANDLED_INTERRUPT;
return ide_adapter->inthand(arg);
return ata_adapter->inthand(arg);
}
@ -99,66 +99,66 @@ static status_t
prepare_dma(void *channel_cookie, const physical_entry *sg_list,
size_t sg_list_count, bool to_device)
{
return ide_adapter->prepare_dma((ide_adapter_channel_info *)channel_cookie, sg_list, sg_list_count, to_device);
return ata_adapter->prepare_dma((ata_adapter_channel_info *)channel_cookie, sg_list, sg_list_count, to_device);
}
static status_t
start_dma(void *channel_cookie)
{
return ide_adapter->start_dma((ide_adapter_channel_info *)channel_cookie);
return ata_adapter->start_dma((ata_adapter_channel_info *)channel_cookie);
}
static status_t
finish_dma(void *channel_cookie)
{
return ide_adapter->finish_dma((ide_adapter_channel_info *)channel_cookie);
return ata_adapter->finish_dma((ata_adapter_channel_info *)channel_cookie);
}
static status_t
init_channel(device_node_handle node, ide_channel ide_channel,
init_channel(device_node_handle node, ata_channel ata_channel,
void **channel_cookie)
{
return ide_adapter->init_channel(node, ide_channel, (ide_adapter_channel_info **)channel_cookie,
sizeof(ide_adapter_channel_info), inthand);
return ata_adapter->init_channel(node, ata_channel, (ata_adapter_channel_info **)channel_cookie,
sizeof(ata_adapter_channel_info), inthand);
}
static status_t
uninit_channel(void *channel_cookie)
{
return ide_adapter->uninit_channel((ide_adapter_channel_info *)channel_cookie);
return ata_adapter->uninit_channel((ata_adapter_channel_info *)channel_cookie);
}
static void channel_removed(device_node_handle node, void *channel_cookie)
{
return ide_adapter->channel_removed(node, (ide_adapter_channel_info *)channel_cookie);
return ata_adapter->channel_removed(node, (ata_adapter_channel_info *)channel_cookie);
}
static status_t
init_controller(device_node_handle node, void *user_cookie,
ide_adapter_controller_info **cookie)
ata_adapter_controller_info **cookie)
{
return ide_adapter->init_controller(node, user_cookie, cookie,
sizeof(ide_adapter_controller_info));
return ata_adapter->init_controller(node, user_cookie, cookie,
sizeof(ata_adapter_controller_info));
}
static status_t
uninit_controller(ide_adapter_controller_info *controller)
uninit_controller(ata_adapter_controller_info *controller)
{
return ide_adapter->uninit_controller(controller);
return ata_adapter->uninit_controller(controller);
}
static void
controller_removed(device_node_handle node, ide_adapter_controller_info *controller)
controller_removed(device_node_handle node, ata_adapter_controller_info *controller)
{
return ide_adapter->controller_removed(node, controller);
return ata_adapter->controller_removed(node, controller);
}
@ -191,12 +191,12 @@ publish_controller(device_node_handle parent, uint16 bus_master_base, uint8 intn
// size of S/G block is 16 bits with zero being 64K
{ B_DMA_MAX_SEGMENT_BLOCKS, B_UINT32_TYPE, { ui32: 0x10000 }},
{ B_DMA_MAX_SEGMENT_COUNT, B_UINT32_TYPE,
{ ui32: IDE_ADAPTER_MAX_SG_COUNT }},
{ ui32: ATA_ADAPTER_MAX_SG_COUNT }},
// private data to find controller
{ IDE_ADAPTER_BUS_MASTER_BASE, B_UINT16_TYPE, { ui16: bus_master_base }},
{ ATA_ADAPTER_BUS_MASTER_BASE, B_UINT16_TYPE, { ui16: bus_master_base }},
// store interrupt in controller node
{ IDE_ADAPTER_INTNUM, B_UINT8_TYPE, { ui8: intnum }},
{ ATA_ADAPTER_INTNUM, B_UINT8_TYPE, { ui8: intnum }},
{ NULL }
};
@ -270,12 +270,12 @@ probe_controller(device_node_handle parent)
if (res != B_OK || controller_node == NULL)
goto err;
ide_adapter->detect_channel(pci, device, controller_node,
ata_adapter->detect_channel(pci, device, controller_node,
PROMISE_TX2_CHANNEL_MODULE_NAME, true,
command_block_base[0], control_block_base[0], bus_master_base, intnum,
0, "Primary Channel", &channels[0], false);
ide_adapter->detect_channel(pci, device, controller_node,
ata_adapter->detect_channel(pci, device, controller_node,
PROMISE_TX2_CHANNEL_MODULE_NAME, true,
command_block_base[1], control_block_base[1], bus_master_base, intnum,
1, "Secondary Channel", &channels[1], false);
@ -307,7 +307,7 @@ std_ops(int32 op, ...)
module_dependency module_dependencies[] = {
{ IDE_FOR_CONTROLLER_MODULE_NAME, (module_info **)&ide },
{ B_DEVICE_MANAGER_MODULE_NAME, (module_info **)&pnp },
{ IDE_ADAPTER_MODULE_NAME, (module_info **)&ide_adapter },
{ ATA_ADAPTER_MODULE_NAME, (module_info **)&ata_adapter },
{}
};

View File

@ -3,14 +3,11 @@
* Distributed under the terms of the MIT License.
*/
#include <KernelExport.h>
#include <stdlib.h>
#include <string.h>
#include <KernelExport.h>
#include <device_manager.h>
#include <bus/IDE.h>
#include <ide_adapter.h>
#include <ata_adapter.h>
#define TRACE(x...) dprintf("si-3112: " x)
//#define FLOW(x...) dprintf("si-3112: " x)
@ -89,7 +86,7 @@ typedef struct channel_data {
pci_device_module_info *pci;
device_node * node;
pci_device * device;
ide_channel ide_channel;
ata_channel ataChannel;
volatile uint8 * task_file;
volatile uint8 * control_block;
@ -109,9 +106,9 @@ typedef struct channel_data {
} channel_data;
static ide_for_controller_interface * ide;
static ide_adapter_interface * ide_adapter;
static device_manager_info * dm;
static ata_for_controller_interface* sATA;
static ata_adapter_interface* sATAAdapter;
static device_manager_info* sDeviceManager;
static status_t device_control_write(void *channel_cookie, uint8 val);
static int32 handle_interrupt(void *arg);
@ -125,13 +122,13 @@ controller_supports(device_node *parent)
uint16 deviceID;
// get the bus (should be PCI)
if (dm->get_attr_string(parent, B_DEVICE_BUS, &bus, false) != B_OK
if (sDeviceManager->get_attr_string(parent, B_DEVICE_BUS, &bus, false) != B_OK
|| strcmp(bus, "pci") != 0)
return B_ERROR;
// get vendor and device ID
if (dm->get_attr_uint16(parent, B_DEVICE_VENDOR_ID, &vendorID, false) != B_OK
|| dm->get_attr_uint16(parent, B_DEVICE_ID, &deviceID, false) != B_OK) {
if (sDeviceManager->get_attr_uint16(parent, B_DEVICE_VENDOR_ID, &vendorID, false) != B_OK
|| sDeviceManager->get_attr_uint16(parent, B_DEVICE_ID, &deviceID, false) != B_OK) {
return B_ERROR;
}
@ -168,7 +165,7 @@ controller_probe(device_node *parent)
TRACE("controller_probe\n");
dm->get_driver(parent, (driver_module_info **)&pci, (void **)&device);
sDeviceManager->get_driver(parent, (driver_module_info **)&pci, (void **)&device);
deviceID = pci->read_pci_config(device, PCI_device_id, 2);
vendorID = pci->read_pci_config(device, PCI_vendor_id, 2);
@ -209,17 +206,17 @@ controller_probe(device_node *parent)
{}
};
device_attr attrs[] = {
// properties of this controller for ide bus manager
// properties of this controller for ATA bus manager
// there are always max. 2 devices
// (unless this is a Compact Flash Card with a built-in IDE controller,
// which has exactly 1 device)
{ IDE_CONTROLLER_MAX_DEVICES_ITEM, B_UINT8_TYPE, { ui8: kASICData[asicIndex].channel_count }},
// (unless this is a Compact Flash Card with a built-in ATA
// controller, which has exactly 1 device)
{ ATA_CONTROLLER_MAX_DEVICES_ITEM, B_UINT8_TYPE,
{ ui8: kASICData[asicIndex].channel_count }},
// of course we can DMA
{ IDE_CONTROLLER_CAN_DMA_ITEM, B_UINT8_TYPE, { ui8: true }},
// command queuing always works
{ IDE_CONTROLLER_CAN_CQ_ITEM, B_UINT8_TYPE, { ui8: true }},
{ ATA_CONTROLLER_CAN_DMA_ITEM, B_UINT8_TYPE, { ui8: true }},
// choose any name here
{ IDE_CONTROLLER_CONTROLLER_NAME_ITEM, B_STRING_TYPE, { string: CONTROLLER_NAME }},
{ ATA_CONTROLLER_CONTROLLER_NAME_ITEM, B_STRING_TYPE,
{ string: CONTROLLER_NAME }},
// DMA properties
// data must be word-aligned;
@ -230,18 +227,21 @@ controller_probe(device_node *parent)
// max size of S/G block is 16 bits with zero being 64K
{ B_DMA_MAX_SEGMENT_BLOCKS, B_UINT32_TYPE, { ui32: 0x10000 }},
{ B_DMA_MAX_SEGMENT_COUNT, B_UINT32_TYPE,
{ ui32: IDE_ADAPTER_MAX_SG_COUNT }},
{ ui32: ATA_ADAPTER_MAX_SG_COUNT }},
// private data to find controller
{ "silicon_image_3112/asic_index", B_UINT32_TYPE, { ui32: asicIndex }},
{ "silicon_image_3112/mmio_base", B_UINT32_TYPE, { ui32: mmioBase }},
{ "silicon_image_3112/int_num", B_UINT32_TYPE, { ui32: interruptNumber }},
{ "silicon_image_3112/asic_index", B_UINT32_TYPE,
{ ui32: asicIndex }},
{ "silicon_image_3112/mmio_base", B_UINT32_TYPE,
{ ui32: mmioBase }},
{ "silicon_image_3112/int_num", B_UINT32_TYPE,
{ ui32: interruptNumber }},
{ NULL }
};
TRACE("publishing controller\n");
return dm->register_node(parent, CONTROLLER_MODULE_NAME, attrs,
return sDeviceManager->register_node(parent, CONTROLLER_MODULE_NAME, attrs,
resources, NULL);
}
}
@ -265,11 +265,11 @@ controller_init(device_node *node, void **_controllerCookie)
TRACE("controller_init\n");
if (dm->get_attr_uint32(node, "silicon_image_3112/asic_index", &asicIndex, false) != B_OK)
if (sDeviceManager->get_attr_uint32(node, "silicon_image_3112/asic_index", &asicIndex, false) != B_OK)
return B_ERROR;
if (dm->get_attr_uint32(node, "silicon_image_3112/mmio_base", &mmioBase, false) != B_OK)
if (sDeviceManager->get_attr_uint32(node, "silicon_image_3112/mmio_base", &mmioBase, false) != B_OK)
return B_ERROR;
if (dm->get_attr_uint32(node, "silicon_image_3112/int_num", &interruptNumber, false) != B_OK)
if (sDeviceManager->get_attr_uint32(node, "silicon_image_3112/int_num", &interruptNumber, false) != B_OK)
return B_ERROR;
controller = malloc(sizeof(controller_data));
@ -287,9 +287,9 @@ controller_init(device_node *node, void **_controllerCookie)
return B_ERROR;
}
parent = dm->get_parent_node(node);
dm->get_driver(parent, (driver_module_info **)&pci, (void **)&device);
dm->put_node(parent);
parent = sDeviceManager->get_parent_node(node);
sDeviceManager->get_driver(parent, (driver_module_info **)&pci, (void **)&device);
sDeviceManager->put_node(parent);
TRACE("asic %ld\n", asicIndex);
TRACE("int_num %ld\n", interruptNumber);
@ -379,17 +379,17 @@ controller_register_channels(void *cookie)
device_attr attrs[] = {
{ B_DEVICE_PRETTY_NAME, B_STRING_TYPE, { string: DRIVER_PRETTY_NAME }},
// { PNP_DRIVER_CONNECTION, B_STRING_TYPE, { string: kControllerChannelData[channelIndex].name }},
{ B_DEVICE_FIXED_CHILD, B_STRING_TYPE, { string: IDE_FOR_CONTROLLER_MODULE_NAME }},
{ B_DEVICE_FIXED_CHILD, B_STRING_TYPE, { string: ATA_FOR_CONTROLLER_MODULE_NAME }},
// private data to identify channel
{ IDE_CONTROLLER_CAN_DMA_ITEM, B_UINT8_TYPE, { ui8: true }},
{ ATA_CONTROLLER_CAN_DMA_ITEM, B_UINT8_TYPE, { ui8: true }},
{ "silicon_image_3112/chan_index", B_UINT32_TYPE, { ui32: index }},
{ NULL }
};
TRACE("publishing %s\n", kControllerChannelData[index].name);
dm->register_node(controller->node, CHANNEL_MODULE_NAME, attrs,
sDeviceManager->register_node(controller->node, CHANNEL_MODULE_NAME, attrs,
NULL, NULL);
}
@ -424,18 +424,18 @@ channel_init(device_node *node, void **_channelCookie)
if (!channel)
return B_NO_MEMORY;
if (dm->get_attr_uint32(node, "silicon_image_3112/chan_index", &channelIndex, false) != B_OK)
if (sDeviceManager->get_attr_uint32(node, "silicon_image_3112/chan_index", &channelIndex, false) != B_OK)
goto err;
#if 0
if (1 /* debug */){
uint8 bus, device, function;
uint16 vendorID, deviceID;
dm->get_attr_uint8(node, PCI_DEVICE_BUS_ITEM, &bus, true);
dm->get_attr_uint8(node, PCI_DEVICE_DEVICE_ITEM, &device, true);
dm->get_attr_uint8(node, PCI_DEVICE_FUNCTION_ITEM, &function, true);
dm->get_attr_uint16(node, PCI_DEVICE_VENDOR_ID_ITEM, &vendorID, true);
dm->get_attr_uint16(node, PCI_DEVICE_DEVICE_ID_ITEM, &deviceID, true);
sDeviceManager->get_attr_uint8(node, PCI_DEVICE_BUS_ITEM, &bus, true);
sDeviceManager->get_attr_uint8(node, PCI_DEVICE_DEVICE_ITEM, &device, true);
sDeviceManager->get_attr_uint8(node, PCI_DEVICE_FUNCTION_ITEM, &function, true);
sDeviceManager->get_attr_uint16(node, PCI_DEVICE_VENDOR_ID_ITEM, &vendorID, true);
sDeviceManager->get_attr_uint16(node, PCI_DEVICE_DEVICE_ID_ITEM, &deviceID, true);
TRACE("bus %3d, device %2d, function %2d: vendor %04x, device %04x\n",
bus, device, function, vendorID, deviceID);
}
@ -446,15 +446,15 @@ channel_init(device_node *node, void **_channelCookie)
TRACE("channel %p\n", channel);
parent = dm->get_parent_node(node);
dm->get_driver(parent, NULL, (void **)&controller);
dm->put_node(parent);
parent = sDeviceManager->get_parent_node(node);
sDeviceManager->get_driver(parent, NULL, (void **)&controller);
sDeviceManager->put_node(parent);
TRACE("controller %p\n", controller);
TRACE("mmio_addr %p\n", (void *)controller->mmio_addr);
// PRDT must be contiguous, dword-aligned and must not cross 64K boundary
prdtSize = (IDE_ADAPTER_MAX_SG_COUNT * sizeof(prd_entry) + (B_PAGE_SIZE - 1)) & ~(B_PAGE_SIZE - 1);
prdtSize = (ATA_ADAPTER_MAX_SG_COUNT * sizeof(prd_entry) + (B_PAGE_SIZE - 1)) & ~(B_PAGE_SIZE - 1);
channel->prd_area = create_area("prd", (void **)&channel->prdt,
B_ANY_KERNEL_ADDRESS, prdtSize, B_CONTIGUOUS, 0);
if (channel->prd_area < B_OK) {
@ -468,15 +468,15 @@ channel_init(device_node *node, void **_channelCookie)
channel->pci = controller->pci;
channel->device = controller->device;
channel->node = node;
channel->ide_channel = NULL;
channel->ataChannel = NULL;
channel->task_file = (volatile uint8 *)(controller->mmio_addr + kControllerChannelData[channelIndex].cmd + 1);
channel->control_block = (volatile uint8 *)(controller->mmio_addr + kControllerChannelData[channelIndex].ctl);
channel->command_block = (volatile uint8 *)(controller->mmio_addr + kControllerChannelData[channelIndex].cmd);
channel->dev_ctrl = (volatile uint8 *)(controller->mmio_addr + kControllerChannelData[channelIndex].ctl);
channel->bm_prdt_address = (volatile uint32 *)(controller->mmio_addr + kControllerChannelData[channelIndex].bmdma + IDE_BM_PRDT_ADDRESS);
channel->bm_status_reg = (volatile uint8 *)(controller->mmio_addr + kControllerChannelData[channelIndex].bmdma + IDE_BM_STATUS_REG);
channel->bm_command_reg = (volatile uint8 *)(controller->mmio_addr + kControllerChannelData[channelIndex].bmdma + IDE_BM_COMMAND_REG);
channel->bm_prdt_address = (volatile uint32 *)(controller->mmio_addr + kControllerChannelData[channelIndex].bmdma + ATA_BM_PRDT_ADDRESS);
channel->bm_status_reg = (volatile uint8 *)(controller->mmio_addr + kControllerChannelData[channelIndex].bmdma + ATA_BM_STATUS_REG);
channel->bm_command_reg = (volatile uint8 *)(controller->mmio_addr + kControllerChannelData[channelIndex].bmdma + ATA_BM_COMMAND_REG);
channel->stat = (volatile uint32 *)(controller->mmio_addr + kControllerChannelData[channelIndex].stat);
channel->lost = 0;
@ -485,7 +485,7 @@ channel_init(device_node *node, void **_channelCookie)
controller->channel[channelIndex] = channel;
// enable interrupts so the channel is ready to run
device_control_write(channel, ide_devctrl_bit3);
device_control_write(channel, ATA_DEVICE_CONTROL_BIT3);
*_channelCookie = channel;
@ -506,7 +506,7 @@ channel_uninit(void *channelCookie)
TRACE("channel_uninit enter\n");
// disable IRQs
device_control_write(channel, ide_devctrl_bit3 | ide_devctrl_nien);
device_control_write(channel, ATA_DEVICE_CONTROL_BIT3 | ATA_DEVICE_CONTROL_DISABLE_INTS);
// catch spurious interrupt
// (some controllers generate an IRQ when you _disable_ interrupts,
@ -529,15 +529,15 @@ channel_removed(void *channelCookie)
static void
set_channel(void *channelCookie, ide_channel ideChannel)
set_channel(void *channelCookie, ata_channel ataChannel)
{
channel_data *channel = channelCookie;
channel->ide_channel = ideChannel;
channel->ataChannel = ataChannel;
}
static status_t
task_file_write(void *channelCookie, ide_task_file *tf, ide_reg_mask mask)
task_file_write(void *channelCookie, ata_task_file *tf, ata_reg_mask mask)
{
channel_data *channel = channelCookie;
int i;
@ -565,7 +565,7 @@ task_file_write(void *channelCookie, ide_task_file *tf, ide_reg_mask mask)
static status_t
task_file_read(void *channelCookie, ide_task_file *tf, ide_reg_mask mask)
task_file_read(void *channelCookie, ata_task_file *tf, ata_reg_mask mask)
{
channel_data *channel = channelCookie;
int i;
@ -709,8 +709,8 @@ dma_prepare(void *channelCookie, const physical_entry *sg_list,
*channel->dev_ctrl; // read altstatus to flush
// reset interrupt and error signal
status = *channel->bm_status_reg | IDE_BM_STATUS_INTERRUPT
| IDE_BM_STATUS_ERROR;
status = *channel->bm_status_reg | ATA_BM_STATUS_INTERRUPT
| ATA_BM_STATUS_ERROR;
*channel->bm_status_reg = status;
*channel->dev_ctrl; // read altstatus to flush
@ -718,9 +718,9 @@ dma_prepare(void *channelCookie, const physical_entry *sg_list,
// set data direction
command = *channel->bm_command_reg;
if (write)
command &= ~IDE_BM_COMMAND_READ_FROM_DEVICE;
command &= ~ATA_BM_COMMAND_READ_FROM_DEVICE;
else
command |= IDE_BM_COMMAND_READ_FROM_DEVICE;
command |= ATA_BM_COMMAND_READ_FROM_DEVICE;
*channel->bm_command_reg = command;
@ -740,7 +740,7 @@ dma_start(void *channelCookie)
FLOW("dma_start enter\n");
command = *channel->bm_command_reg | IDE_BM_COMMAND_START_STOP;
command = *channel->bm_command_reg | ATA_BM_COMMAND_START_STOP;
channel->dma_active = true;
*channel->bm_command_reg = command;
@ -764,18 +764,18 @@ dma_finish(void *channelCookie)
status = *channel->bm_status_reg;
command = *channel->bm_command_reg;
*channel->bm_command_reg = command & ~IDE_BM_COMMAND_START_STOP;
*channel->bm_command_reg = command & ~ATA_BM_COMMAND_START_STOP;
channel->dma_active = false;
*channel->bm_status_reg = status | IDE_BM_STATUS_ERROR;
*channel->bm_status_reg = status | ATA_BM_STATUS_ERROR;
*channel->dev_ctrl; // read altstatus to flush
if ((status & IDE_BM_STATUS_ACTIVE) != 0) {
if ((status & ATA_BM_STATUS_ACTIVE) != 0) {
TRACE("dma_finish: buffer too large\n");
return B_DEV_DATA_OVERRUN;
}
if ((status & IDE_BM_STATUS_ERROR) != 0) {
if ((status & ATA_BM_STATUS_ERROR) != 0) {
FLOW("dma_finish: failed\n");
return B_ERROR;
}
@ -798,7 +798,7 @@ handle_interrupt(void *arg)
result = B_UNHANDLED_INTERRUPT;
for (i = 0; i < controller->channel_count; i++) {
for (i = 0; i < controller->channel_count; i++) {
channel_data *channel = controller->channel[i];
if (!channel || channel->lost)
continue;
@ -811,9 +811,10 @@ handle_interrupt(void *arg)
continue;
statusBM = *channel->bm_status_reg;
if (statusBM & IDE_BM_STATUS_INTERRUPT) {
*channel->bm_status_reg = (statusBM & 0xf8) | IDE_BM_STATUS_INTERRUPT;
ide->irq_handler(channel->ide_channel, statusATA);
if (statusBM & ATA_BM_STATUS_INTERRUPT) {
*channel->bm_status_reg
= (statusBM & 0xf8) | ATA_BM_STATUS_INTERRUPT;
sATA->interrupt_handler(channel->ataChannel, statusATA);
result = B_INVOKE_SCHEDULER;
}
}
@ -823,14 +824,14 @@ handle_interrupt(void *arg)
module_dependency module_dependencies[] = {
{ IDE_FOR_CONTROLLER_MODULE_NAME, (module_info **)&ide },
{ B_DEVICE_MANAGER_MODULE_NAME, (module_info **)&dm },
{ IDE_ADAPTER_MODULE_NAME, (module_info **)&ide_adapter },
{ ATA_FOR_CONTROLLER_MODULE_NAME, (module_info **)&sATA },
{ B_DEVICE_MANAGER_MODULE_NAME, (module_info **)&sDeviceManager },
{ ATA_ADAPTER_MODULE_NAME, (module_info **)&sATAAdapter },
{}
};
static ide_controller_interface sChannelInterface = {
static ata_controller_interface sChannelInterface = {
{
{
CHANNEL_MODULE_NAME,

View File

@ -14,37 +14,32 @@
#include <malloc.h>
#include <string.h>
#include <device_manager.h>
#include <bus/PCI.h>
#include <bus/IDE.h>
#include <ide_types.h>
#include <ide_adapter.h>
#include <lendian_bitfield.h>
#include <ata_adapter.h>
#define debug_level_flow 0
#define debug_level_error 3
#define debug_level_info 3
#define DEBUG_MSG_PREFIX "IDE PCI -- "
#define DEBUG_MSG_PREFIX "ATA PCI -- "
#include "wrapper.h"
#define TRACE dprintf
static ide_for_controller_interface *ide;
static device_manager_info *pnp;
static ata_for_controller_interface *sATA;
static device_manager_info *sDeviceManager;
static void
set_channel(ide_adapter_channel_info *channel, ide_channel ideChannel)
set_channel(ata_adapter_channel_info *channel, ata_channel ataChannel)
{
channel->ide_channel = ideChannel;
channel->ataChannel = ataChannel;
}
static status_t
ide_adapter_write_command_block_regs(ide_adapter_channel_info *channel,
ide_task_file *tf, ide_reg_mask mask)
ata_adapter_write_command_block_regs(ata_adapter_channel_info *channel,
ata_task_file *tf, ata_reg_mask mask)
{
pci_device_module_info *pci = channel->pci;
pci_device *device = channel->device;
@ -73,8 +68,8 @@ ide_adapter_write_command_block_regs(ide_adapter_channel_info *channel,
static status_t
ide_adapter_read_command_block_regs(ide_adapter_channel_info *channel,
ide_task_file *tf, ide_reg_mask mask)
ata_adapter_read_command_block_regs(ata_adapter_channel_info *channel,
ata_task_file *tf, ata_reg_mask mask)
{
pci_device_module_info *pci = channel->pci;
pci_device *device = channel->device;
@ -97,7 +92,7 @@ ide_adapter_read_command_block_regs(ide_adapter_channel_info *channel,
static uint8
ide_adapter_get_altstatus(ide_adapter_channel_info *channel)
ata_adapter_get_altstatus(ata_adapter_channel_info *channel)
{
pci_device_module_info *pci = channel->pci;
pci_device *device = channel->device;
@ -111,7 +106,7 @@ ide_adapter_get_altstatus(ide_adapter_channel_info *channel)
static status_t
ide_adapter_write_device_control(ide_adapter_channel_info *channel, uint8 val)
ata_adapter_write_device_control(ata_adapter_channel_info *channel, uint8 val)
{
pci_device_module_info *pci = channel->pci;
pci_device *device = channel->device;
@ -129,7 +124,7 @@ ide_adapter_write_device_control(ide_adapter_channel_info *channel, uint8 val)
static status_t
ide_adapter_write_pio(ide_adapter_channel_info *channel, uint16 *data,
ata_adapter_write_pio(ata_adapter_channel_info *channel, uint16 *data,
int count, bool force_16bit)
{
pci_device_module_info *pci = channel->pci;
@ -157,7 +152,7 @@ ide_adapter_write_pio(ide_adapter_channel_info *channel, uint16 *data,
static status_t
ide_adapter_read_pio(ide_adapter_channel_info *channel, uint16 *data,
ata_adapter_read_pio(ata_adapter_channel_info *channel, uint16 *data,
int count, bool force_16bit)
{
pci_device_module_info *pci = channel->pci;
@ -185,9 +180,9 @@ ide_adapter_read_pio(ide_adapter_channel_info *channel, uint16 *data,
static int32
ide_adapter_inthand(void *arg)
ata_adapter_inthand(void *arg)
{
ide_adapter_channel_info *channel = (ide_adapter_channel_info *)arg;
ata_adapter_channel_info *channel = (ata_adapter_channel_info *)arg;
pci_device_module_info *pci = channel->pci;
pci_device *device = channel->device;
uint8 statusATA, statusBM;
@ -201,15 +196,15 @@ ide_adapter_inthand(void *arg)
// read bus master DMA status to test if the interrupt was
// really generated by our controller
statusBM = pci->read_io_8(device, channel->bus_master_base
+ IDE_BM_STATUS_REG);
statusBM = pci->read_io_8(device, channel->bus_master_base
+ ATA_BM_STATUS_REG);
if (statusBM & IDE_BM_STATUS_INTERRUPT) {
if (statusBM & ATA_BM_STATUS_INTERRUPT) {
// clear pending PCI bus master DMA interrupt
pci->write_io_8(device, channel->bus_master_base + IDE_BM_STATUS_REG,
(statusBM & 0xf8) | IDE_BM_STATUS_INTERRUPT);
pci->write_io_8(device, channel->bus_master_base + ATA_BM_STATUS_REG,
(statusBM & 0xf8) | ATA_BM_STATUS_INTERRUPT);
// signal interrupt to ATA stack
return ide->irq_handler(channel->ide_channel, statusATA);
return sATA->interrupt_handler(channel->ataChannel, statusATA);
} else {
return B_UNHANDLED_INTERRUPT;
}
@ -217,7 +212,7 @@ ide_adapter_inthand(void *arg)
static status_t
ide_adapter_prepare_dma(ide_adapter_channel_info *channel,
ata_adapter_prepare_dma(ata_adapter_channel_info *channel,
const physical_entry *sgList, size_t sgListCount, bool writeToDevice)
{
pci_device_module_info *pci = channel->pci;
@ -236,25 +231,25 @@ ide_adapter_prepare_dma(ide_adapter_channel_info *channel,
SHOW_FLOW( 4, "%x, %x, %d", (int)prd->address, prd->count, prd->EOT);
}
pci->write_io_32(device, channel->bus_master_base + IDE_BM_PRDT_ADDRESS,
(pci->read_io_32(device, channel->bus_master_base + IDE_BM_PRDT_ADDRESS) & 3)
pci->write_io_32(device, channel->bus_master_base + ATA_BM_PRDT_ADDRESS,
(pci->read_io_32(device, channel->bus_master_base + ATA_BM_PRDT_ADDRESS) & 3)
| (B_HOST_TO_LENDIAN_INT32(pci->ram_address(device, (void *)channel->prdt_phys)) & ~3));
// reset interrupt and error signal
status = pci->read_io_8(device, channel->bus_master_base
+ IDE_BM_STATUS_REG) | IDE_BM_STATUS_INTERRUPT | IDE_BM_STATUS_ERROR;
+ ATA_BM_STATUS_REG) | ATA_BM_STATUS_INTERRUPT | ATA_BM_STATUS_ERROR;
pci->write_io_8(device,
channel->bus_master_base + IDE_BM_STATUS_REG, status);
channel->bus_master_base + ATA_BM_STATUS_REG, status);
// set data direction
command = pci->read_io_8(device, channel->bus_master_base
+ IDE_BM_COMMAND_REG);
+ ATA_BM_COMMAND_REG);
if (writeToDevice)
command &= ~IDE_BM_COMMAND_READ_FROM_DEVICE;
command &= ~ATA_BM_COMMAND_READ_FROM_DEVICE;
else
command |= IDE_BM_COMMAND_READ_FROM_DEVICE;
command |= ATA_BM_COMMAND_READ_FROM_DEVICE;
pci->write_io_8(device, channel->bus_master_base + IDE_BM_COMMAND_REG,
pci->write_io_8(device, channel->bus_master_base + ATA_BM_COMMAND_REG,
command);
return B_OK;
@ -262,20 +257,20 @@ ide_adapter_prepare_dma(ide_adapter_channel_info *channel,
static status_t
ide_adapter_start_dma(ide_adapter_channel_info *channel)
ata_adapter_start_dma(ata_adapter_channel_info *channel)
{
pci_device_module_info *pci = channel->pci;
pci_device *device = channel->device;
uint8 command;
command = pci->read_io_8(device, channel->bus_master_base
+ IDE_BM_COMMAND_REG);
+ ATA_BM_COMMAND_REG);
command |= IDE_BM_COMMAND_START_STOP;
command |= ATA_BM_COMMAND_START_STOP;
channel->dmaing = true;
pci->write_io_8(device, channel->bus_master_base + IDE_BM_COMMAND_REG,
pci->write_io_8(device, channel->bus_master_base + ATA_BM_COMMAND_REG,
command);
return B_OK;
@ -283,7 +278,7 @@ ide_adapter_start_dma(ide_adapter_channel_info *channel)
static status_t
ide_adapter_finish_dma(ide_adapter_channel_info *channel)
ata_adapter_finish_dma(ata_adapter_channel_info *channel)
{
pci_device_module_info *pci = channel->pci;
pci_device *device = channel->device;
@ -292,24 +287,24 @@ ide_adapter_finish_dma(ide_adapter_channel_info *channel)
// read BM status first
status = pci->read_io_8(device, channel->bus_master_base
+ IDE_BM_STATUS_REG);
+ ATA_BM_STATUS_REG);
// stop DMA engine, this also clears IDE_BM_STATUS_ACTIVE
// stop DMA engine, this also clears ATA_BM_STATUS_ACTIVE
// in the BM status register
command = pci->read_io_8(device, channel->bus_master_base
+ IDE_BM_COMMAND_REG);
pci->write_io_8(device, channel->bus_master_base + IDE_BM_COMMAND_REG,
command & ~IDE_BM_COMMAND_START_STOP);
+ ATA_BM_COMMAND_REG);
pci->write_io_8(device, channel->bus_master_base + ATA_BM_COMMAND_REG,
command & ~ATA_BM_COMMAND_START_STOP);
channel->dmaing = false;
// reset error flag
pci->write_io_8(device, channel->bus_master_base + IDE_BM_STATUS_REG,
status | IDE_BM_STATUS_ERROR);
pci->write_io_8(device, channel->bus_master_base + ATA_BM_STATUS_REG,
status | ATA_BM_STATUS_ERROR);
if ((status & IDE_BM_STATUS_ACTIVE) != 0)
if ((status & ATA_BM_STATUS_ACTIVE) != 0)
return B_DEV_DATA_OVERRUN;
if ((status & IDE_BM_STATUS_ERROR) != 0)
if ((status & ATA_BM_STATUS_ERROR) != 0)
return B_ERROR;
return B_OK;
@ -317,12 +312,12 @@ ide_adapter_finish_dma(ide_adapter_channel_info *channel)
static status_t
ide_adapter_init_channel(device_node *node,
ide_adapter_channel_info **cookie, size_t total_data_size,
ata_adapter_init_channel(device_node *node,
ata_adapter_channel_info **cookie, size_t total_data_size,
int32 (*inthand)(void *arg))
{
ide_adapter_controller_info *controller;
ide_adapter_channel_info *channel;
ata_adapter_controller_info *controller;
ata_adapter_channel_info *channel;
uint16 command_block_base, control_block_base;
uint8 intnum;
int prdt_size;
@ -336,30 +331,30 @@ ide_adapter_init_channel(device_node *node,
if (1 /* debug */){
uint8 bus, device, function;
uint16 vendorID, deviceID;
pnp->get_attr_uint8(node, PCI_DEVICE_BUS_ITEM, &bus, true);
pnp->get_attr_uint8(node, PCI_DEVICE_DEVICE_ITEM, &device, true);
pnp->get_attr_uint8(node, PCI_DEVICE_FUNCTION_ITEM, &function, true);
pnp->get_attr_uint16(node, PCI_DEVICE_VENDOR_ID_ITEM, &vendorID, true);
pnp->get_attr_uint16(node, PCI_DEVICE_DEVICE_ID_ITEM, &deviceID, true);
sDeviceManager->get_attr_uint8(node, PCI_DEVICE_BUS_ITEM, &bus, true);
sDeviceManager->get_attr_uint8(node, PCI_DEVICE_DEVICE_ITEM, &device, true);
sDeviceManager->get_attr_uint8(node, PCI_DEVICE_FUNCTION_ITEM, &function, true);
sDeviceManager->get_attr_uint16(node, PCI_DEVICE_VENDOR_ID_ITEM, &vendorID, true);
sDeviceManager->get_attr_uint16(node, PCI_DEVICE_DEVICE_ID_ITEM, &deviceID, true);
TRACE("PCI-IDE: bus %3d, device %2d, function %2d: vendor %04x, device %04x\n",
bus, device, function, vendorID, deviceID);
}
#endif
// get device data
if (pnp->get_attr_uint16(node, IDE_ADAPTER_COMMAND_BLOCK_BASE, &command_block_base, false) != B_OK
|| pnp->get_attr_uint16(node, IDE_ADAPTER_CONTROL_BLOCK_BASE, &control_block_base, false) != B_OK
|| pnp->get_attr_uint8(node, IDE_ADAPTER_INTNUM, &intnum, true) != B_OK
|| pnp->get_attr_uint8(node, IDE_ADAPTER_CHANNEL_INDEX, &channel_index, false) != B_OK)
if (sDeviceManager->get_attr_uint16(node, ATA_ADAPTER_COMMAND_BLOCK_BASE, &command_block_base, false) != B_OK
|| sDeviceManager->get_attr_uint16(node, ATA_ADAPTER_CONTROL_BLOCK_BASE, &control_block_base, false) != B_OK
|| sDeviceManager->get_attr_uint8(node, ATA_ADAPTER_INTNUM, &intnum, true) != B_OK
|| sDeviceManager->get_attr_uint8(node, ATA_ADAPTER_CHANNEL_INDEX, &channel_index, false) != B_OK)
return B_ERROR;
{
device_node *parent = pnp->get_parent_node(node);
pnp->get_driver(parent, NULL, (void **)&controller);
pnp->put_node(parent);
device_node *parent = sDeviceManager->get_parent_node(node);
sDeviceManager->get_driver(parent, NULL, (void **)&controller);
sDeviceManager->put_node(parent);
}
channel = (ide_adapter_channel_info *)malloc(total_data_size);
channel = (ata_adapter_channel_info *)malloc(total_data_size);
if (channel == NULL) {
res = B_NO_MEMORY;
goto err;
@ -381,7 +376,7 @@ ide_adapter_init_channel(device_node *node,
TRACE("PCI-IDE: bus master base %#x\n", channel->bus_master_base);
// PRDT must be contiguous, dword-aligned and must not cross 64K boundary
prdt_size = (IDE_ADAPTER_MAX_SG_COUNT * sizeof( prd_entry ) + (B_PAGE_SIZE - 1)) & ~(B_PAGE_SIZE - 1);
prdt_size = (ATA_ADAPTER_MAX_SG_COUNT * sizeof( prd_entry ) + (B_PAGE_SIZE - 1)) & ~(B_PAGE_SIZE - 1);
channel->prd_area = create_area("prd", (void **)&channel->prdt, B_ANY_KERNEL_ADDRESS,
prdt_size, B_CONTIGUOUS, 0);
if (channel->prd_area < B_OK) {
@ -405,7 +400,7 @@ ide_adapter_init_channel(device_node *node,
TRACE("PCI-IDE: init channel done\n");
// disable interrupts
ide_adapter_write_device_control(channel, ide_devctrl_bit3 | ide_devctrl_nien);
ata_adapter_write_device_control(channel, ATA_DEVICE_CONTROL_BIT3 | ATA_DEVICE_CONTROL_DISABLE_INTS);
*cookie = channel;
@ -422,10 +417,10 @@ err:
static void
ide_adapter_uninit_channel(ide_adapter_channel_info *channel)
ata_adapter_uninit_channel(ata_adapter_channel_info *channel)
{
// disable IRQs
ide_adapter_write_device_control(channel, ide_devctrl_bit3 | ide_devctrl_nien);
ata_adapter_write_device_control(channel, ATA_DEVICE_CONTROL_BIT3 | ATA_DEVICE_CONTROL_DISABLE_INTS);
// catch spurious interrupt
// (some controllers generate an IRQ when you _disable_ interrupts,
@ -440,7 +435,7 @@ ide_adapter_uninit_channel(ide_adapter_channel_info *channel)
static void
ide_adapter_channel_removed(ide_adapter_channel_info *channel)
ata_adapter_channel_removed(ata_adapter_channel_info *channel)
{
SHOW_FLOW0( 3, "" );
@ -450,10 +445,10 @@ ide_adapter_channel_removed(ide_adapter_channel_info *channel)
}
/** publish node of ide channel */
/** publish node of ata channel */
static status_t
ide_adapter_publish_channel(device_node *controller_node,
ata_adapter_publish_channel(device_node *controller_node,
const char *channel_module_name, uint16 command_block_base,
uint16 control_block_base, uint8 intnum, bool can_dma,
uint8 channel_index, const char *name, const io_resource *resources,
@ -462,20 +457,20 @@ ide_adapter_publish_channel(device_node *controller_node,
device_attr attrs[] = {
// info about ourself and our consumer
{ B_DEVICE_PRETTY_NAME, B_STRING_TYPE, { string: "IDE PCI" }},
{ B_DEVICE_FIXED_CHILD, B_STRING_TYPE, { string: IDE_FOR_CONTROLLER_MODULE_NAME }},
{ B_DEVICE_FIXED_CHILD, B_STRING_TYPE, { string: ATA_FOR_CONTROLLER_MODULE_NAME }},
// private data to identify channel
{ IDE_ADAPTER_COMMAND_BLOCK_BASE, B_UINT16_TYPE, { ui16: command_block_base }},
{ IDE_ADAPTER_CONTROL_BLOCK_BASE, B_UINT16_TYPE, { ui16: control_block_base }},
{ IDE_CONTROLLER_CAN_DMA_ITEM, B_UINT8_TYPE, { ui8: can_dma }},
{ IDE_ADAPTER_INTNUM, B_UINT8_TYPE, { ui8: intnum }},
{ IDE_ADAPTER_CHANNEL_INDEX, B_UINT8_TYPE, { ui8: channel_index }},
{ ATA_ADAPTER_COMMAND_BLOCK_BASE, B_UINT16_TYPE, { ui16: command_block_base }},
{ ATA_ADAPTER_CONTROL_BLOCK_BASE, B_UINT16_TYPE, { ui16: control_block_base }},
{ ATA_CONTROLLER_CAN_DMA_ITEM, B_UINT8_TYPE, { ui8: can_dma }},
{ ATA_ADAPTER_INTNUM, B_UINT8_TYPE, { ui8: intnum }},
{ ATA_ADAPTER_CHANNEL_INDEX, B_UINT8_TYPE, { ui8: channel_index }},
{ NULL }
};
SHOW_FLOW0(2, "");
return pnp->register_node(controller_node, channel_module_name, attrs,
return sDeviceManager->register_node(controller_node, channel_module_name, attrs,
resources, node);
}
@ -483,7 +478,7 @@ ide_adapter_publish_channel(device_node *controller_node,
/** detect IDE channel */
static status_t
ide_adapter_detect_channel(pci_device_module_info *pci, pci_device *pci_device,
ata_adapter_detect_channel(pci_device_module_info *pci, pci_device *pci_device,
device_node *controller_node, const char *channel_module_name,
bool controller_can_dma, uint16 command_block_base, uint16 control_block_base,
uint16 bus_master_base, uint8 intnum, uint8 channel_index, const char *name,
@ -497,14 +492,14 @@ ide_adapter_detect_channel(pci_device_module_info *pci, pci_device *pci_device,
api = pci->read_pci_config(pci_device, PCI_class_api, 1);
if (supports_compatibility_mode
&& channel_index == 0 && (api & IDE_API_PRIMARY_NATIVE) == 0) {
&& channel_index == 0 && (api & ATA_API_PRIMARY_NATIVE) == 0) {
command_block_base = 0x1f0;
control_block_base = 0x3f6;
intnum = 14;
TRACE("PCI-IDE: Controller in legacy mode: cmd %#x, ctrl %#x, irq %d\n",
command_block_base, control_block_base, intnum);
} else if (supports_compatibility_mode
&& channel_index == 1 && (api & IDE_API_PRIMARY_NATIVE) == 0) {
&& channel_index == 1 && (api & ATA_API_PRIMARY_NATIVE) == 0) {
command_block_base = 0x170;
control_block_base = 0x376;
intnum = 15;
@ -531,9 +526,9 @@ ide_adapter_detect_channel(pci_device_module_info *pci, pci_device *pci_device,
if (supports_compatibility_mode) {
// read status of primary(!) channel to detect simplex
uint8 status = pci->read_io_8(pci_device, bus_master_base
+ IDE_BM_STATUS_REG);
+ ATA_BM_STATUS_REG);
if (status & IDE_BM_STATUS_SIMPLEX_DMA && channel_index != 0) {
if (status & ATA_BM_STATUS_SIMPLEX_DMA && channel_index != 0) {
// in simplex mode, channels cannot operate independantly of each other;
// we simply disable bus mastering of second channel to satisfy that;
// better were to use a controller lock, but this had to be done in the IDE
@ -551,7 +546,7 @@ ide_adapter_detect_channel(pci_device_module_info *pci, pci_device *pci_device,
{}
};
return ide_adapter_publish_channel(controller_node, channel_module_name,
return ata_adapter_publish_channel(controller_node, channel_module_name,
command_block_base, control_block_base, intnum, controller_can_dma,
channel_index, name, resources, node);
}
@ -559,26 +554,26 @@ ide_adapter_detect_channel(pci_device_module_info *pci, pci_device *pci_device,
static status_t
ide_adapter_init_controller(device_node *node,
ide_adapter_controller_info **cookie, size_t total_data_size)
ata_adapter_init_controller(device_node *node,
ata_adapter_controller_info **cookie, size_t total_data_size)
{
pci_device_module_info *pci;
pci_device *device;
ide_adapter_controller_info *controller;
ata_adapter_controller_info *controller;
uint16 bus_master_base;
// uint16 pcicmd;
// get device data
if (pnp->get_attr_uint16(node, IDE_ADAPTER_BUS_MASTER_BASE, &bus_master_base, false) != B_OK)
if (sDeviceManager->get_attr_uint16(node, ATA_ADAPTER_BUS_MASTER_BASE, &bus_master_base, false) != B_OK)
return B_ERROR;
{
device_node *parent = pnp->get_parent_node(node);
pnp->get_driver(parent, (driver_module_info **)&pci, (void **)&device);
pnp->put_node(parent);
device_node *parent = sDeviceManager->get_parent_node(node);
sDeviceManager->get_driver(parent, (driver_module_info **)&pci, (void **)&device);
sDeviceManager->put_node(parent);
}
controller = (ide_adapter_controller_info *)malloc(total_data_size);
controller = (ata_adapter_controller_info *)malloc(total_data_size);
if (controller == NULL)
return B_NO_MEMORY;
@ -610,14 +605,14 @@ ide_adapter_init_controller(device_node *node,
static void
ide_adapter_uninit_controller(ide_adapter_controller_info *controller)
ata_adapter_uninit_controller(ata_adapter_controller_info *controller)
{
free(controller);
}
static void
ide_adapter_controller_removed(ide_adapter_controller_info *controller)
ata_adapter_controller_removed(ata_adapter_controller_info *controller)
{
SHOW_FLOW0(3, "");
@ -628,27 +623,25 @@ ide_adapter_controller_removed(ide_adapter_controller_info *controller)
}
/** publish node of ide controller */
/** publish node of ata controller */
static status_t
ide_adapter_publish_controller(device_node *parent, uint16 bus_master_base,
ata_adapter_publish_controller(device_node *parent, uint16 bus_master_base,
io_resource *resources, const char *controller_driver,
const char *controller_driver_type, const char *controller_name, bool can_dma,
bool can_cq, uint32 dma_alignment, uint32 dma_boundary, uint32 max_sg_block_size,
device_node **node)
{
device_attr attrs[] = {
// properties of this controller for ide bus manager
// properties of this controller for ata bus manager
// there are always max. 2 devices
// (unless this is a Compact Flash Card with a built-in IDE controller,
// which has exactly 1 device)
{ IDE_CONTROLLER_MAX_DEVICES_ITEM, B_UINT8_TYPE, { ui8: 2 }},
{ ATA_CONTROLLER_MAX_DEVICES_ITEM, B_UINT8_TYPE, { ui8: 2 }},
// of course we can DMA
{ IDE_CONTROLLER_CAN_DMA_ITEM, B_UINT8_TYPE, { ui8: can_dma }},
// command queuing always works (unless controller is buggy)
{ IDE_CONTROLLER_CAN_CQ_ITEM, B_UINT8_TYPE, { ui8: can_cq }},
{ ATA_CONTROLLER_CAN_DMA_ITEM, B_UINT8_TYPE, { ui8: can_dma }},
// choose any name here
{ IDE_CONTROLLER_CONTROLLER_NAME_ITEM, B_STRING_TYPE,
{ ATA_CONTROLLER_CONTROLLER_NAME_ITEM, B_STRING_TYPE,
{ string: controller_name }},
// DMA properties
@ -661,23 +654,23 @@ ide_adapter_publish_controller(device_node *parent, uint16 bus_master_base,
{ B_DMA_MAX_SEGMENT_BLOCKS, B_UINT32_TYPE,
{ ui32: max_sg_block_size/*0x10000*/ }},
{ B_DMA_MAX_SEGMENT_COUNT, B_UINT32_TYPE,
{ ui32: IDE_ADAPTER_MAX_SG_COUNT }},
{ ui32: ATA_ADAPTER_MAX_SG_COUNT }},
// private data to find controller
{ IDE_ADAPTER_BUS_MASTER_BASE, B_UINT16_TYPE, { ui16: bus_master_base }},
{ ATA_ADAPTER_BUS_MASTER_BASE, B_UINT16_TYPE, { ui16: bus_master_base }},
{ NULL }
};
SHOW_FLOW0( 2, "" );
return pnp->register_node(parent, controller_driver, attrs, resources, node);
return sDeviceManager->register_node(parent, controller_driver, attrs, resources, node);
}
/** detect pure IDE controller, i.e. without channels */
static status_t
ide_adapter_detect_controller(pci_device_module_info *pci, pci_device *pci_device,
ata_adapter_detect_controller(pci_device_module_info *pci, pci_device *pci_device,
device_node *parent, uint16 bus_master_base, const char *controller_driver,
const char *controller_driver_type, const char *controller_name, bool can_dma,
bool can_cq, uint32 dma_alignment, uint32 dma_boundary, uint32 max_sg_block_size,
@ -695,14 +688,14 @@ ide_adapter_detect_controller(pci_device_module_info *pci, pci_device *pci_devic
return B_ERROR;
}
return ide_adapter_publish_controller(parent, bus_master_base, resources,
return ata_adapter_publish_controller(parent, bus_master_base, resources,
controller_driver, controller_driver_type, controller_name, can_dma, can_cq,
dma_alignment, dma_boundary, max_sg_block_size, node);
}
static status_t
ide_adapter_probe_controller(device_node *parent, const char *controller_driver,
ata_adapter_probe_controller(device_node *parent, const char *controller_driver,
const char *controller_driver_type, const char *controller_name,
const char *channel_module_name, bool can_dma, bool can_cq, uint32 dma_alignment,
uint32 dma_boundary, uint32 max_sg_block_size, bool supports_compatibility_mode)
@ -719,7 +712,7 @@ ide_adapter_probe_controller(device_node *parent, const char *controller_driver,
SHOW_FLOW0( 3, "" );
pnp->get_driver(parent, (driver_module_info **)&pci, (void **)&device);
sDeviceManager->get_driver(parent, (driver_module_info **)&pci, (void **)&device);
command_block_base[0] = pci->read_pci_config(device, PCI_base_registers, 4 );
control_block_base[0] = pci->read_pci_config(device, PCI_base_registers + 4, 4);
@ -734,7 +727,7 @@ ide_adapter_probe_controller(device_node *parent, const char *controller_driver,
control_block_base[1] &= PCI_address_io_mask;
bus_master_base &= PCI_address_io_mask;
res = ide_adapter_detect_controller(pci, device, parent, bus_master_base,
res = ata_adapter_detect_controller(pci, device, parent, bus_master_base,
controller_driver, controller_driver_type, controller_name, can_dma,
can_cq, dma_alignment, dma_boundary, max_sg_block_size, &controller_node);
// don't register if controller is already registered!
@ -743,11 +736,11 @@ ide_adapter_probe_controller(device_node *parent, const char *controller_driver,
return res;
// ignore errors during registration of channels - could be a simple rescan collision
ide_adapter_detect_channel(pci, device, controller_node, channel_module_name,
ata_adapter_detect_channel(pci, device, controller_node, channel_module_name,
can_dma, command_block_base[0], control_block_base[0], bus_master_base,
intnum, 0, "Primary Channel", &channels[0], supports_compatibility_mode);
ide_adapter_detect_channel(pci, device, controller_node, channel_module_name,
ata_adapter_detect_channel(pci, device, controller_node, channel_module_name,
can_dma, command_block_base[1], control_block_base[1], bus_master_base,
intnum, 1, "Secondary Channel", &channels[1], supports_compatibility_mode);
@ -770,51 +763,51 @@ std_ops(int32 op, ...)
module_dependency module_dependencies[] = {
{ IDE_FOR_CONTROLLER_MODULE_NAME, (module_info **)&ide },
{ B_DEVICE_MANAGER_MODULE_NAME, (module_info **)&pnp },
{ ATA_FOR_CONTROLLER_MODULE_NAME, (module_info **)&sATA },
{ B_DEVICE_MANAGER_MODULE_NAME, (module_info **)&sDeviceManager },
{}
};
static ide_adapter_interface adapter_interface = {
static ata_adapter_interface adapter_interface = {
{
IDE_ADAPTER_MODULE_NAME,
ATA_ADAPTER_MODULE_NAME,
0,
std_ops
},
set_channel,
ide_adapter_write_command_block_regs,
ide_adapter_read_command_block_regs,
ata_adapter_write_command_block_regs,
ata_adapter_read_command_block_regs,
ide_adapter_get_altstatus,
ide_adapter_write_device_control,
ata_adapter_get_altstatus,
ata_adapter_write_device_control,
ide_adapter_write_pio,
ide_adapter_read_pio,
ata_adapter_write_pio,
ata_adapter_read_pio,
ide_adapter_prepare_dma,
ide_adapter_start_dma,
ide_adapter_finish_dma,
ata_adapter_prepare_dma,
ata_adapter_start_dma,
ata_adapter_finish_dma,
ide_adapter_inthand,
ata_adapter_inthand,
ide_adapter_init_channel,
ide_adapter_uninit_channel,
ide_adapter_channel_removed,
ata_adapter_init_channel,
ata_adapter_uninit_channel,
ata_adapter_channel_removed,
ide_adapter_publish_channel,
ide_adapter_detect_channel,
ata_adapter_publish_channel,
ata_adapter_detect_channel,
ide_adapter_init_controller,
ide_adapter_uninit_controller,
ide_adapter_controller_removed,
ata_adapter_init_controller,
ata_adapter_uninit_controller,
ata_adapter_controller_removed,
ide_adapter_publish_controller,
ide_adapter_detect_controller,
ata_adapter_publish_controller,
ata_adapter_detect_controller,
ide_adapter_probe_controller
ata_adapter_probe_controller
};
module_info *modules[] = {