Changes in / [5759975a:4c9b28a] in mainline
- Location:
- uspace
- Files:
-
- 5 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/isa/isa.c
r5759975a r4c9b28a 67 67 68 68 #include <device/hw_res.h> 69 #include <device/pio_window.h>70 69 71 70 #include "i8237.h" … … 80 79 ddf_dev_t *dev; 81 80 ddf_fun_t *fctl; 82 pio_window_t pio_win;83 81 list_t functions; 84 82 } isa_bus_t; … … 407 405 hw_resource_t *resources = fun->hw_resources.resources; 408 406 409 isa_bus_t *isa = isa_bus(ddf_fun_get_dev(fun->fnode));410 411 407 if (count < ISA_MAX_HW_RES) { 412 408 resources[count].type = IO_RANGE; 413 409 resources[count].res.io_range.address = addr; 414 resources[count].res.io_range.address += isa->pio_win.io.base;415 410 resources[count].res.io_range.size = len; 416 411 resources[count].res.io_range.endianness = LITTLE_ENDIAN; … … 609 604 static int isa_dev_add(ddf_dev_t *dev) 610 605 { 611 async_sess_t *sess;612 int rc;613 614 606 ddf_msg(LVL_DEBUG, "isa_dev_add, device handle = %d", 615 607 (int) ddf_dev_get_handle(dev)); … … 622 614 isa->dev = dev; 623 615 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 }638 616 639 617 /* Make the bus device more visible. Does not do anything. */ -
uspace/drv/bus/pci/pciintel/pci.c
r5759975a r4c9b28a 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>61 59 #include <ddi.h> 62 60 #include <pci_dev_iface.h> … … 143 141 } 144 142 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 155 143 static int pci_config_space_write_32(ddf_fun_t *fun, uint32_t address, 156 144 uint32_t data) … … 210 198 .get_resource_list = &pciintel_get_resources, 211 199 .enable_interrupt = &pciintel_enable_interrupt, 212 };213 214 static pio_window_ops_t pciintel_pio_window_ops = {215 .get_pio_window = &pciintel_get_pio_window216 200 }; 217 201 … … 227 211 static ddf_dev_ops_t pci_fun_ops = { 228 212 .interfaces[HW_RES_DEV_IFACE] = &pciintel_hw_res_ops, 229 .interfaces[PIO_WINDOW_DEV_IFACE] = &pciintel_pio_window_ops,230 213 .interfaces[PCI_DEV_IFACE] = &pci_dev_ops 231 214 }; … … 634 617 pci_read_bars(fun); 635 618 pci_read_interrupt(fun); 636 637 /* Propagate the PIO window to the function. */638 fun->pio_window = bus->pio_win;639 619 640 620 ddf_fun_set_ops(fun->fnode, &pci_fun_ops); … … 667 647 static int pci_dev_add(ddf_dev_t *dnode) 668 648 { 669 hw_resource_list_t hw_resources;670 649 pci_bus_t *bus = NULL; 671 650 ddf_fun_t *ctl = NULL; … … 693 672 goto fail; 694 673 } 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 } 674 675 hw_resource_list_t hw_resources; 702 676 703 677 rc = hw_res_get_resource_list(sess, &hw_resources); … … 789 763 { 790 764 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; 791 767 } 792 768 -
uspace/drv/bus/pci/pciintel/pci.h
r5759975a r4c9b28a 40 40 #include "pci_regs.h" 41 41 42 #define PCI_MAX_HW_RES 1042 #define PCI_MAX_HW_RES 8 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;52 51 fibril_mutex_t conf_mutex; 53 52 } pci_bus_t; … … 69 68 hw_resource_list_t hw_resources; 70 69 hw_resource_t resources[PCI_MAX_HW_RES]; 71 pio_window_t pio_window;72 70 } pci_fun_t; 73 71 -
uspace/drv/infrastructure/rootmalta/rootmalta.c
r5759975a r4c9b28a 53 53 #include <ops/hw_res.h> 54 54 #include <device/hw_res.h> 55 #include <ops/pio_window.h>56 #include <device/pio_window.h>57 55 #include <byteorder.h> 58 56 … … 68 66 #define GT_PCI_CMD_MBYTESWAP 0x1 69 67 70 #define GT_PCI_MEMBASE UINT32_C(0x10000000)71 #define GT_PCI_MEMSIZE UINT32_C(0x08000000)72 73 #define GT_PCI_IOBASE UINT32_C(0x18000000)74 #define GT_PCI_IOSIZE UINT32_C(0x00200000)75 76 68 typedef struct rootmalta_fun { 77 69 hw_resource_list_t hw_resources; 78 pio_window_t pio_window;79 70 } rootmalta_fun_t; 80 71 … … 116 107 sizeof(pci_conf_regs) / sizeof(pci_conf_regs[0]), 117 108 pci_conf_regs 118 },119 .pio_window = {120 .mem = {121 .base = GT_PCI_MEMBASE,122 .size = GT_PCI_MEMSIZE123 },124 .io = {125 .base = GT_PCI_IOBASE,126 .size = GT_PCI_IOSIZE127 }128 109 } 129 110 }; … … 148 129 149 130 return false; 150 }151 152 static pio_window_t *rootmalta_get_pio_window(ddf_fun_t *fnode)153 {154 rootmalta_fun_t *fun = rootmalta_fun(fnode);155 156 assert(fun != NULL);157 return &fun->pio_window;158 131 } 159 132 … … 161 134 .get_resource_list = &rootmalta_get_resources, 162 135 .enable_interrupt = &rootmalta_enable_interrupt, 163 };164 165 static pio_window_ops_t fun_pio_window_ops = {166 .get_pio_window = &rootmalta_get_pio_window167 136 }; 168 137 … … 259 228 ddf_log_init(NAME); 260 229 rootmalta_fun_ops.interfaces[HW_RES_DEV_IFACE] = &fun_hw_res_ops; 261 rootmalta_fun_ops.interfaces[PIO_WINDOW_DEV_IFACE] = &fun_pio_window_ops;262 230 } 263 231 -
uspace/drv/infrastructure/rootpc/rootpc.c
r5759975a r4c9b28a 51 51 #include <ops/hw_res.h> 52 52 #include <device/hw_res.h> 53 #include <ops/pio_window.h>54 #include <device/pio_window.h>55 53 56 54 #define NAME "rootpc" … … 58 56 typedef struct rootpc_fun { 59 57 hw_resource_list_t hw_resources; 60 pio_window_t pio_window;61 58 } rootpc_fun_t; 62 59 … … 96 93 static rootpc_fun_t pci_data = { 97 94 .hw_resources = { 98 sizeof(pci_conf_regs) /sizeof(pci_conf_regs[0]),95 sizeof(pci_conf_regs)/sizeof(pci_conf_regs[0]), 99 96 pci_conf_regs 100 },101 .pio_window = {102 .mem = {103 .base = UINT32_C(0),104 .size = UINT32_C(0xffffffff) /* practical maximum */105 },106 .io = {107 .base = UINT32_C(0),108 .size = UINT32_C(0x10000)109 }110 97 } 111 98 }; … … 130 117 131 118 return false; 132 }133 134 static pio_window_t *rootpc_get_pio_window(ddf_fun_t *fnode)135 {136 rootpc_fun_t *fun = rootpc_fun(fnode);137 138 assert(fun != NULL);139 return &fun->pio_window;140 119 } 141 120 … … 143 122 .get_resource_list = &rootpc_get_resources, 144 123 .enable_interrupt = &rootpc_enable_interrupt, 145 };146 147 static pio_window_ops_t fun_pio_window_ops = {148 .get_pio_window = &rootpc_get_pio_window149 124 }; 150 125 … … 222 197 ddf_log_init(NAME); 223 198 rootpc_fun_ops.interfaces[HW_RES_DEV_IFACE] = &fun_hw_res_ops; 224 rootpc_fun_ops.interfaces[PIO_WINDOW_DEV_IFACE] = &fun_pio_window_ops;225 199 } 226 200 -
uspace/lib/c/Makefile
r5759975a r4c9b28a 69 69 generic/device/hw_res.c \ 70 70 generic/device/hw_res_parsed.c \ 71 generic/device/pio_window.c \72 71 generic/device/char_dev.c \ 73 72 generic/device/clock_dev.c \ -
uspace/lib/c/include/ipc/dev_iface.h
r5759975a r4c9b28a 36 36 typedef enum { 37 37 HW_RES_DEV_IFACE = 0, 38 PIO_WINDOW_DEV_IFACE,39 38 40 39 /** Character device interface */ -
uspace/lib/drv/Makefile
r5759975a r4c9b28a 41 41 generic/remote_audio_pcm.c \ 42 42 generic/remote_hw_res.c \ 43 generic/remote_pio_window.c \44 43 generic/remote_char_dev.c \ 45 44 generic/remote_graph_dev.c \ -
uspace/lib/drv/generic/dev_iface.c
r5759975a r4c9b28a 40 40 #include "dev_iface.h" 41 41 #include "remote_hw_res.h" 42 #include "remote_pio_window.h"43 42 #include "remote_char_dev.h" 44 43 #include "remote_clock_dev.h" … … 59 58 [AUDIO_PCM_BUFFER_IFACE] = &remote_audio_pcm_iface, 60 59 [HW_RES_DEV_IFACE] = &remote_hw_res_iface, 61 [PIO_WINDOW_DEV_IFACE] = &remote_pio_window_iface,62 60 [CHAR_DEV_IFACE] = &remote_char_dev_iface, 63 61 [GRAPH_DEV_IFACE] = &remote_graph_dev_iface,
Note:
See TracChangeset
for help on using the changeset viewer.