| 196 | } |
| 197 | |
| 198 | const char *device_ini_get(vga_device_t *dev, const char *property) |
| 199 | { |
| 200 | int n, i; |
| 201 | switch(dev->type) |
| 202 | { |
| 203 | case VGA_DEVICE_ISA: |
| 204 | n = iniSectionsCount("[isa]"); |
| 205 | for(i = 0; i < n; i++) |
| 206 | { |
| 207 | const char *s_pnp = iniSectionsValue("[isa]", i, "pnp"); |
| 208 | if(s_pnp) |
| 209 | { |
| 210 | uint16_t pnp = strtoul(s_pnp, NULL, 0); |
| 211 | if(pnp == dev->isa.pnp) |
| 212 | { |
| 213 | return iniSectionsValue("[isa]", i, property); |
| 214 | } |
| 215 | } |
| 216 | } |
| 217 | break; |
| 218 | case VGA_DEVICE_PCI: |
| 219 | n = iniSectionsCount("[pci]"); |
| 220 | for(i = 0; i < n; i++) |
| 221 | { |
| 222 | const char *s_ven = iniSectionsValue("[pci]", i, "ven"); |
| 223 | const char *s_dev = iniSectionsValue("[pci]", i, "dev"); |
| 224 | const char *s_subsys = iniSectionsValue("[pci]", i, "subsys"); |
| 225 | const char *s_class = iniSectionsValue("[pci]", i, "class"); |
| 226 | |
| 227 | if(s_ven && s_dev) |
| 228 | { |
| 229 | uint16_t ven_id = strtoul(s_ven, NULL, 0); |
| 230 | uint16_t dev_id = strtoul(s_dev, NULL, 0); |
| 231 | |
| 232 | //printf("scan: %04X %04X\n", ven_id, dev_id); |
| 233 | |
| 234 | if(ven_id == dev->pci.ven && dev_id == dev->pci.dev) |
| 235 | { |
| 236 | BOOL found = FALSE; |
| 237 | if(s_subsys == NULL) |
| 238 | { |
| 239 | found = TRUE; |
| 240 | } |
| 241 | else if(dev->pci.has_subsys && s_subsys != NULL) |
| 242 | { |
| 243 | uint32_t subsys_id = strtoul(s_subsys, NULL, 0); |
| 244 | |
| 245 | //printf(" subsys %08X\n", subsys_id); |
| 246 | |
| 247 | if(subsys_id == dev->pci.subsys) |
| 248 | { |
| 249 | found = TRUE; |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | if(found) |
| 254 | { |
| 255 | return iniSectionsValue("[pci]", i, property); |
no test coverage detected