Changeset 443695e in mainline for uspace/drv
- Timestamp:
- 2024-05-21T11:33:56Z (17 months ago)
- Branches:
- master
- Children:
- 3526f4f3
- Parents:
- 1801005
- git-author:
- Jiri Svoboda <jiri@…> (2024-05-20 17:33:43)
- git-committer:
- Jiri Svoboda <jiri@…> (2024-05-21 11:33:56)
- Location:
- uspace/drv
- Files:
-
- 8 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/block/isa-ide/isa-ide.c
r1801005 r443695e 34 34 * @file 35 35 * @brief ISA IDE driver 36 *37 * The driver services a single IDE channel.38 36 */ 39 37 -
uspace/drv/block/isa-ide/main.c
r1801005 r443695e 66 66 }; 67 67 68 static errno_t ata_get_res(ddf_dev_t *dev, isa_ide_hwres_t *ata_res)68 static errno_t isa_ide_get_res(ddf_dev_t *dev, isa_ide_hwres_t *res) 69 69 { 70 70 async_sess_t *parent_sess; 71 71 hw_res_list_parsed_t hw_res; 72 hw_res_flags_t flags; 72 73 errno_t rc; 73 74 … … 75 76 if (parent_sess == NULL) 76 77 return ENOMEM; 78 79 rc = hw_res_get_flags(parent_sess, &flags); 80 if (rc != EOK) 81 return rc; 82 83 /* 84 * Prevent attaching to the legacy ISA IDE register block 85 * on a system with PCI not to conflict with PCI IDE. 86 * 87 * XXX This is a simplification. If we had a PCI-based system without 88 * PCI-IDE or with PCI-IDE disabled and would still like to use 89 * an ISA IDE controller, this would prevent us from doing so. 90 */ 91 if (flags & hwf_isa_bridge) { 92 ddf_msg(LVL_NOTE, "Will not attach to PCI/ISA bridge."); 93 return EIO; 94 } 77 95 78 96 hw_res_list_parsed_init(&hw_res); … … 92 110 addr_range_t *cmd2_rng = &hw_res.io_ranges.ranges[2]; 93 111 addr_range_t *ctl2_rng = &hw_res.io_ranges.ranges[3]; 94 ata_res->cmd1 = RNGABS(*cmd1_rng);95 ata_res->ctl1 = RNGABS(*ctl1_rng);96 ata_res->cmd2 = RNGABS(*cmd2_rng);97 ata_res->ctl2 = RNGABS(*ctl2_rng);112 res->cmd1 = RNGABS(*cmd1_rng); 113 res->ctl1 = RNGABS(*ctl1_rng); 114 res->cmd2 = RNGABS(*cmd2_rng); 115 res->ctl2 = RNGABS(*ctl2_rng); 98 116 99 117 if (RNGSZ(*ctl1_rng) < sizeof(ata_ctl_t)) { … … 119 137 /* IRQ */ 120 138 if (hw_res.irqs.count > 0) { 121 ata_res->irq1 = hw_res.irqs.irqs[0];139 res->irq1 = hw_res.irqs.irqs[0]; 122 140 } else { 123 ata_res->irq1 = -1;141 res->irq1 = -1; 124 142 } 125 143 126 144 if (hw_res.irqs.count > 1) { 127 ata_res->irq2 = hw_res.irqs.irqs[1];145 res->irq2 = hw_res.irqs.irqs[1]; 128 146 } else { 129 ata_res->irq2 = -1;147 res->irq2 = -1; 130 148 } 131 149 … … 147 165 errno_t rc; 148 166 149 rc = ata_get_res(dev, &res);167 rc = isa_ide_get_res(dev, &res); 150 168 if (rc != EOK) { 151 169 ddf_msg(LVL_ERROR, "Invalid HW resource configuration."); -
uspace/drv/bus/isa/isa.c
r1801005 r443695e 76 76 typedef struct { 77 77 fibril_mutex_t mutex; 78 bool pci_isa_bridge; 78 79 uint16_t pci_vendor_id; 79 80 uint16_t pci_device_id; … … 92 93 hw_resource_list_t hw_resources; 93 94 link_t bus_link; 95 isa_bus_t *bus; 94 96 } isa_fun_t; 95 97 … … 204 206 } 205 207 208 static errno_t isa_fun_get_flags(ddf_fun_t *fnode, hw_res_flags_t *rflags) 209 { 210 isa_fun_t *fun = isa_fun(fnode); 211 hw_res_flags_t flags; 212 213 flags = 0; 214 if (fun->bus->pci_isa_bridge) 215 flags |= hwf_isa_bridge; 216 217 ddf_msg(LVL_NOTE, "isa_fun_get_flags: returning 0x%x", flags); 218 *rflags = flags; 219 return EOK; 220 } 221 206 222 static hw_res_ops_t isa_fun_hw_res_ops = { 207 223 .get_resource_list = isa_fun_get_resources, … … 211 227 .dma_channel_setup = isa_fun_setup_dma, 212 228 .dma_channel_remain = isa_fun_remain_dma, 229 .get_flags = isa_fun_get_flags 213 230 }; 214 231 … … 264 281 fibril_mutex_initialize(&fun->mutex); 265 282 fun->hw_resources.resources = fun->resources; 283 fun->bus = isa; 266 284 267 285 fun->fnode = fnode; … … 743 761 if (rc != EOK) { 744 762 ddf_msg(LVL_NOTE, "Cannot read PCI config. Assuming ISA classic."); 763 isa->pci_isa_bridge = false; 745 764 isa->pci_vendor_id = 0; 746 765 isa->pci_device_id = 0; 747 766 isa->pci_class = BASE_CLASS_BRIDGE; 748 767 isa->pci_subclass = SUB_CLASS_BRIDGE_ISA; 768 } else { 769 ddf_msg(LVL_NOTE, "ISA Bridge"); 770 isa->pci_isa_bridge = true; 749 771 } 750 772 -
uspace/drv/meson.build
r1801005 r443695e 35 35 'block/ddisk', 36 36 'block/isa-ide', 37 'block/pci-ide', 37 38 'block/usbmast', 38 39 'block/virtio-blk',
Note:
See TracChangeset
for help on using the changeset viewer.