2 * Copyright 2002/03, Thomas Kurschel. All rights reserved.
3 * Distributed under the terms of the MIT License.
7 Part of Open IDE bus manager
9 Manager of IDE controllers
11 Whenever a new IDE channel is reported, a new SIM is
12 registered at the SCSI bus manager.
15 #include "ide_internal.h"
22 /** called when an IDE channel was registered by a controller driver */
25 ide_channel_added(device_node
*parent
)
27 const char *controller_name
= NULL
;
32 if (pnp
->get_attr_string(parent
, IDE_CONTROLLER_CONTROLLER_NAME_ITEM
,
33 &controller_name
, true) != B_OK
) {
34 dprintf("ide: ignored controller - controller name missing\n");
38 channel_id
= pnp
->create_id(IDE_CHANNEL_ID_GENERATOR
);
41 SHOW_ERROR(0, "Cannot register IDE controller %s - out of IDs", controller_name
);
48 { B_DEVICE_FIXED_CHILD
, B_STRING_TYPE
, { string
: SCSI_FOR_SIM_MODULE_NAME
}},
50 { SCSI_DESCRIPTION_CONTROLLER_NAME
, B_STRING_TYPE
,
51 { string
: controller_name
}},
52 // maximum number of blocks per transmission:
53 // - ATAPI uses packets, i.e. normal SCSI limits apply
54 // but I'm not sure about controller restrictions
55 // - ATA allows up to 256 blocks
56 // - some broken disk's firmware (read: IBM DTTA drives)
57 // don't like 256 blocks in command queuing mode
58 // -> use 255 blocks as a least common nominator
59 // (this is still 127.5K for HDs and 510K for CDs,
60 // which should be sufficient)
61 // Note: to fix specific drive bugs, use ide_sim_get_restrictions()
63 { B_DMA_MAX_TRANSFER_BLOCKS
, B_UINT32_TYPE
, { ui32
: 255 }},
64 { IDE_CHANNEL_ID_ITEM
, B_UINT32_TYPE
, { ui32
: channel_id
}},
65 // { PNP_MANAGER_ID_GENERATOR, B_STRING_TYPE, { string: IDE_CHANNEL_ID_GENERATOR }},
66 // { PNP_MANAGER_AUTO_ID, B_UINT32_TYPE, { ui32: channel_id }},
71 return pnp
->register_node(parent
, IDE_SIM_MODULE_NAME
, attrs
, NULL
,
81 std_ops(int32 op
, ...)
94 ide_for_controller_interface ide_for_controller_module
= {
97 IDE_FOR_CONTROLLER_MODULE_NAME
,
102 NULL
, // supported devices