aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/legacy/macide.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/legacy/macide.c')
-rw-r--r--drivers/ide/legacy/macide.c52
1 files changed, 28 insertions, 24 deletions
diff --git a/drivers/ide/legacy/macide.c b/drivers/ide/legacy/macide.c
index 5c6aa77c2370..782d4c76c0e5 100644
--- a/drivers/ide/legacy/macide.c
+++ b/drivers/ide/legacy/macide.c
@@ -77,15 +77,17 @@ int macide_ack_intr(ide_hwif_t* hwif)
77 return 0; 77 return 0;
78} 78}
79 79
80static const char *mac_ide_name[] =
81 { "Quadra", "Powerbook", "Powerbook Baboon" };
82
80/* 83/*
81 * Probe for a Macintosh IDE interface 84 * Probe for a Macintosh IDE interface
82 */ 85 */
83 86
84void __init macide_init(void) 87static int __init macide_init(void)
85{ 88{
86 hw_regs_t hw; 89 hw_regs_t hw;
87 ide_hwif_t *hwif; 90 ide_hwif_t *hwif;
88 int index = -1;
89 91
90 switch (macintosh_config->ide_type) { 92 switch (macintosh_config->ide_type) {
91 case MAC_IDE_QUADRA: 93 case MAC_IDE_QUADRA:
@@ -93,48 +95,50 @@ void __init macide_init(void)
93 0, 0, macide_ack_intr, 95 0, 0, macide_ack_intr,
94// quadra_ide_iops, 96// quadra_ide_iops,
95 IRQ_NUBUS_F); 97 IRQ_NUBUS_F);
96 index = ide_register_hw(&hw, NULL, 1, &hwif);
97 break; 98 break;
98 case MAC_IDE_PB: 99 case MAC_IDE_PB:
99 ide_setup_ports(&hw, IDE_BASE, macide_offsets, 100 ide_setup_ports(&hw, IDE_BASE, macide_offsets,
100 0, 0, macide_ack_intr, 101 0, 0, macide_ack_intr,
101// macide_pb_iops, 102// macide_pb_iops,
102 IRQ_NUBUS_C); 103 IRQ_NUBUS_C);
103 index = ide_register_hw(&hw, NULL, 1, &hwif);
104 break; 104 break;
105 case MAC_IDE_BABOON: 105 case MAC_IDE_BABOON:
106 ide_setup_ports(&hw, BABOON_BASE, macide_offsets, 106 ide_setup_ports(&hw, BABOON_BASE, macide_offsets,
107 0, 0, NULL, 107 0, 0, NULL,
108// macide_baboon_iops, 108// macide_baboon_iops,
109 IRQ_BABOON_1); 109 IRQ_BABOON_1);
110 index = ide_register_hw(&hw, NULL, 1, &hwif); 110 break;
111 if (index == -1) break; 111 default:
112 if (macintosh_config->ident == MAC_MODEL_PB190) { 112 return -ENODEV;
113 }
114
115 printk(KERN_INFO "ide: Macintosh %s IDE controller\n",
116 mac_ide_name[macintosh_config->ide_type - 1]);
113 117
118 hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]);
119 if (hwif) {
120 u8 index = hwif->index;
121 u8 idx[4] = { index, 0xff, 0xff, 0xff };
122
123 ide_init_port_data(hwif, index);
124 ide_init_port_hw(hwif, &hw);
125
126 if (macintosh_config->ide_type == MAC_IDE_BABOON &&
127 macintosh_config->ident == MAC_MODEL_PB190) {
114 /* Fix breakage in ide-disk.c: drive capacity */ 128 /* Fix breakage in ide-disk.c: drive capacity */
115 /* is not initialized for drives without a */ 129 /* is not initialized for drives without a */
116 /* hardware ID, and we can't get that without */ 130 /* hardware ID, and we can't get that without */
117 /* probing the drive which freezes a 190. */ 131 /* probing the drive which freezes a 190. */
118 132 ide_drive_t *drive = &hwif->drives[0];
119 ide_drive_t *drive = &ide_hwifs[index].drives[0];
120 drive->capacity64 = drive->cyl*drive->head*drive->sect; 133 drive->capacity64 = drive->cyl*drive->head*drive->sect;
121
122 } 134 }
123 break;
124
125 default:
126 return;
127 }
128 135
129 if (index != -1) {
130 hwif->mmio = 1; 136 hwif->mmio = 1;
131 if (macintosh_config->ide_type == MAC_IDE_QUADRA) 137
132 printk(KERN_INFO "ide%d: Macintosh Quadra IDE interface\n", index); 138 ide_device_add(idx);
133 else if (macintosh_config->ide_type == MAC_IDE_PB)
134 printk(KERN_INFO "ide%d: Macintosh Powerbook IDE interface\n", index);
135 else if (macintosh_config->ide_type == MAC_IDE_BABOON)
136 printk(KERN_INFO "ide%d: Macintosh Powerbook Baboon IDE interface\n", index);
137 else
138 printk(KERN_INFO "ide%d: Unknown Macintosh IDE interface\n", index);
139 } 139 }
140
141 return 0;
140} 142}
143
144module_init(macide_init);