Changeset 5759975a in mainline for uspace/drv/bus
- Timestamp:
- 2013-09-11T17:55:18Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f18d01b6
- Parents:
- 4c9b28a (diff), 26bc0fd1 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- uspace/drv/bus
- Files:
-
- 3 edited
-
isa/isa.c (modified) (5 diffs)
-
pci/pciintel/pci.c (modified) (8 diffs)
-
pci/pciintel/pci.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/isa/isa.c
r4c9b28a r5759975a 67 67 68 68 #include <device/hw_res.h> 69 #include <device/pio_window.h> 69 70 70 71 #include "i8237.h" … … 79 80 ddf_dev_t *dev; 80 81 ddf_fun_t *fctl; 82 pio_window_t pio_win; 81 83 list_t functions; 82 84 } isa_bus_t; … … 405 407 hw_resource_t *resources = fun->hw_resources.resources; 406 408 409 isa_bus_t *isa = isa_bus(ddf_fun_get_dev(fun->fnode)); 410 407 411 if (count < ISA_MAX_HW_RES) { 408 412 resources[count].type = IO_RANGE; 409 413 resources[count].res.io_range.address = addr; 414 resources[count].res.io_range.address += isa->pio_win.io.base; 410 415 resources[count].res.io_range.size = len; 411 416 resources[count].res.io_range.endianness = LITTLE_ENDIAN; … … 604 609 static int isa_dev_add(ddf_dev_t *dev) 605 610 { 611 async_sess_t *sess; 612 int rc; 613 606 614 ddf_msg(LVL_DEBUG, "isa_dev_add, device handle = %d", 607 615 (int) ddf_dev_get_handle(dev)); … … 614 622 isa->dev = dev; 615 623 list_initialize(&isa->functions); 624 625 sess = ddf_dev_parent_sess_create(dev, EXCHANGE_SERIALIZE); 626 if (sess == NULL) { 627 ddf_msg(LVL_ERROR, "isa_dev_add failed to connect to the " 628 "parent driver."); 629 return ENOENT; 630 } 631 632 rc = pio_window_get(sess, &isa->pio_win); 633 if (rc != EOK) { 634 ddf_msg(LVL_ERROR, "isa_dev_add failed to get PIO window " 635 "for the device."); 636 return rc; 637 } 616 638 617 639 /* Make the bus device more visible. Does not do anything. */ -
uspace/drv/bus/pci/pciintel/pci.c
r4c9b28a r5759975a 57 57 #include <ops/hw_res.h> 58 58 #include <device/hw_res.h> 59 #include <ops/pio_window.h> 60 #include <device/pio_window.h> 59 61 #include <ddi.h> 60 62 #include <pci_dev_iface.h> … … 141 143 } 142 144 145 static pio_window_t *pciintel_get_pio_window(ddf_fun_t *fnode) 146 { 147 pci_fun_t *fun = pci_fun(fnode); 148 149 if (fun == NULL) 150 return NULL; 151 return &fun->pio_window; 152 } 153 154 143 155 static int pci_config_space_write_32(ddf_fun_t *fun, uint32_t address, 144 156 uint32_t data) … … 198 210 .get_resource_list = &pciintel_get_resources, 199 211 .enable_interrupt = &pciintel_enable_interrupt, 212 }; 213 214 static pio_window_ops_t pciintel_pio_window_ops = { 215 .get_pio_window = &pciintel_get_pio_window 200 216 }; 201 217 … … 211 227 static ddf_dev_ops_t pci_fun_ops = { 212 228 .interfaces[HW_RES_DEV_IFACE] = &pciintel_hw_res_ops, 229 .interfaces[PIO_WINDOW_DEV_IFACE] = &pciintel_pio_window_ops, 213 230 .interfaces[PCI_DEV_IFACE] = &pci_dev_ops 214 231 }; … … 617 634 pci_read_bars(fun); 618 635 pci_read_interrupt(fun); 636 637 /* Propagate the PIO window to the function. */ 638 fun->pio_window = bus->pio_win; 619 639 620 640 ddf_fun_set_ops(fun->fnode, &pci_fun_ops); … … 647 667 static int pci_dev_add(ddf_dev_t *dnode) 648 668 { 669 hw_resource_list_t hw_resources; 649 670 pci_bus_t *bus = NULL; 650 671 ddf_fun_t *ctl = NULL; … … 672 693 goto fail; 673 694 } 674 675 hw_resource_list_t hw_resources; 695 696 rc = pio_window_get(sess, &bus->pio_win); 697 if (rc != EOK) { 698 ddf_msg(LVL_ERROR, "pci_dev_add failed to get PIO window " 699 "for the device."); 700 goto fail; 701 } 676 702 677 703 rc = hw_res_get_resource_list(sess, &hw_resources); … … 763 789 { 764 790 ddf_log_init(NAME); 765 pci_fun_ops.interfaces[HW_RES_DEV_IFACE] = &pciintel_hw_res_ops;766 pci_fun_ops.interfaces[PCI_DEV_IFACE] = &pci_dev_ops;767 791 } 768 792 -
uspace/drv/bus/pci/pciintel/pci.h
r4c9b28a r5759975a 40 40 #include "pci_regs.h" 41 41 42 #define PCI_MAX_HW_RES 842 #define PCI_MAX_HW_RES 10 43 43 44 44 typedef struct pciintel_bus { … … 49 49 void *conf_data_port; 50 50 void *conf_addr_port; 51 pio_window_t pio_win; 51 52 fibril_mutex_t conf_mutex; 52 53 } pci_bus_t; … … 68 69 hw_resource_list_t hw_resources; 69 70 hw_resource_t resources[PCI_MAX_HW_RES]; 71 pio_window_t pio_window; 70 72 } pci_fun_t; 71 73
Note:
See TracChangeset
for help on using the changeset viewer.
