Changeset fbfe59d in mainline
- Timestamp:
- 2018-06-25T21:45:05Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8119363
- Parents:
- 2498b95 (diff), e3107e2 (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. - Files:
-
- 8 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/Makefile.common
r2498b95 rfbfe59d 139 139 nic/rtl8169 \ 140 140 nic/ar9271 \ 141 nic/virtio-net \ 141 142 block/ahci 142 143 -
tools/ew.py
r2498b95 rfbfe59d 146 146 return ' -device rtl8139,vlan=0' 147 147 148 def qemu_nic_virtio_options(): 149 return ' -device virtio-net,vlan=0' 150 148 151 def qemu_net_options(): 149 152 if is_override('nonet'): … … 158 161 if 'ne2k' in overrides['net'].keys(): 159 162 nic_options += qemu_nic_ne2k_options() 163 if 'virtio-net' in overrides['net'].keys(): 164 nic_options += qemu_nic_virtio_options() 160 165 else: 161 166 # Use the default NIC … … 326 331 def usage(): 327 332 print("%s - emulator wrapper for running HelenOS\n" % os.path.basename(sys.argv[0])) 328 print("%s [-d] [-h] [-net e1k|rtl8139|ne2k ] [-nohdd] [-nokvm] [-nonet] [-nosnd] [-nousb] [-noxhci] [-notablet]\n" %333 print("%s [-d] [-h] [-net e1k|rtl8139|ne2k|virtio-net] [-nohdd] [-nokvm] [-nonet] [-nosnd] [-nousb] [-noxhci] [-notablet]\n" % 329 334 os.path.basename(sys.argv[0])) 330 335 print("-d\tDry run: do not run the emulation, just print the command line.") … … 360 365 elif sys.argv[i] == 'ne2k': 361 366 overrides['net']['ne2k'] = True 367 elif sys.argv[i] == 'virtio-net': 368 overrides['net']['virtio-net'] = True 362 369 else: 363 370 usage() -
uspace/Makefile
r2498b95 rfbfe59d 181 181 drv/nic/rtl8169 \ 182 182 drv/nic/ar9271 \ 183 drv/nic/virtio-net \ 183 184 drv/platform/amdm37x \ 184 185 drv/platform/icp \ … … 251 252 lib/bithenge \ 252 253 lib/posix \ 253 lib/ieee80211 254 lib/ieee80211 \ 255 lib/virtio 254 256 255 257 BASE_BUILDS := $(addsuffix .build,$(BASE_LIBS)) -
uspace/drv/bus/pci/pciintel/pci.c
r2498b95 rfbfe59d 738 738 739 739 if (pio_enable_resource(&bus->pio_win, 740 &hw_resources.resources[0], 741 (void **) &bus->conf_space)) {740 &hw_resources.resources[0], (void **) &bus->conf_space, 741 NULL, NULL)) { 742 742 ddf_msg(LVL_ERROR, 743 743 "Failed to map configuration space."); … … 759 759 760 760 if (pio_enable_resource(&bus->pio_win, 761 &hw_resources.resources[0], 762 (void **) &bus->conf_addr_reg)) {761 &hw_resources.resources[0], (void **) &bus->conf_addr_reg, 762 NULL, NULL)) { 763 763 ddf_msg(LVL_ERROR, 764 764 "Failed to enable configuration ports."); … … 767 767 } 768 768 if (pio_enable_resource(&bus->pio_win, 769 &hw_resources.resources[1], 770 (void **) &bus->conf_data_reg)) {769 &hw_resources.resources[1], (void **) &bus->conf_data_reg, 770 NULL, NULL)) { 771 771 ddf_msg(LVL_ERROR, 772 772 "Failed to enable configuration ports."); -
uspace/lib/c/generic/ddi.c
r2498b95 rfbfe59d 220 220 /** Enable PIO for specified HW resource wrt. to the PIO window. 221 221 * 222 * @param win PIO window. May be NULL if the resources are known to be 223 * absolute. 224 * @param res Resources specifying the I/O range wrt. to the PIO window. 225 * @param virt Virtual address for application's PIO operations. 222 * @param win PIO window. May be NULL if the resources are known to be 223 * absolute. 224 * @param res Resources specifying the I/O range wrt. to the PIO window. 225 * @param[out] virt Virtual address for application's PIO operations. 226 * @param[out] phys If non-NULL, physical address of the resource 227 * @param[out] size If non-NULL, size of the enabled resource. 226 228 * 227 229 * @return EOK on success. … … 229 231 * 230 232 */ 231 errno_t pio_enable_resource(pio_window_t *win, hw_resource_t *res, void **virt) 233 errno_t pio_enable_resource(pio_window_t *win, hw_resource_t *res, void **virt, 234 uintptr_t *phys, size_t *size) 232 235 { 233 236 uintptr_t addr; 234 size_t s ize;237 size_t sz; 235 238 236 239 switch (res->type) { … … 242 245 addr += win->io.base; 243 246 } 244 s ize= res->res.io_range.size;247 sz = res->res.io_range.size; 245 248 break; 246 249 case MEM_RANGE: … … 251 254 addr += win->mem.base; 252 255 } 253 s ize= res->res.mem_range.size;256 sz = res->res.mem_range.size; 254 257 break; 255 258 default: … … 257 260 } 258 261 259 return pio_enable((void *) addr, size, virt); 262 if (phys) 263 *phys = addr; 264 if (size) 265 *size = sz; 266 267 return pio_enable((void *) addr, sz, virt); 260 268 } 261 269 -
uspace/lib/c/include/ddi.h
r2498b95 rfbfe59d 40 40 #include <stdint.h> 41 41 #include <sys/time.h> 42 #include <byteorder.h> 42 43 #include <abi/ddi/irq.h> 43 44 #include <device/hw_res.h> … … 64 65 65 66 extern errno_t pio_enable_range(addr_range_t *, void **); 66 extern errno_t pio_enable_resource(pio_window_t *, hw_resource_t *, void **); 67 extern errno_t pio_enable_resource(pio_window_t *, hw_resource_t *, void **, 68 uintptr_t *, size_t *); 67 69 extern errno_t pio_enable(void *, size_t, void **); 68 70 extern errno_t pio_disable(void *, size_t); … … 85 87 extern uint64_t pio_read_64(const ioport64_t *); 86 88 89 static inline void pio_write_le16(ioport16_t *reg, uint16_t val) 90 { 91 pio_write_16(reg, host2uint16_t_le(val)); 92 } 93 static inline void pio_write_be16(ioport16_t *reg, uint16_t val) 94 { 95 pio_write_16(reg, host2uint16_t_be(val)); 96 } 97 static inline void pio_write_le32(ioport32_t *reg, uint32_t val) 98 { 99 pio_write_32(reg, host2uint32_t_le(val)); 100 } 101 static inline void pio_write_be32(ioport32_t *reg, uint32_t val) 102 { 103 pio_write_32(reg, host2uint32_t_be(val)); 104 } 105 static inline void pio_write_le64(ioport64_t *reg, uint64_t val) 106 { 107 pio_write_64(reg, host2uint64_t_le(val)); 108 } 109 static inline void pio_write_be64(ioport64_t *reg, uint64_t val) 110 { 111 pio_write_64(reg, host2uint64_t_be(val)); 112 } 113 114 static inline uint16_t pio_read_le16(const ioport16_t *reg) 115 { 116 return uint16_t_le2host(pio_read_16(reg)); 117 } 118 static inline uint16_t pio_read_be16(const ioport16_t *reg) 119 { 120 return uint16_t_be2host(pio_read_16(reg)); 121 } 122 static inline uint32_t pio_read_le32(const ioport32_t *reg) 123 { 124 return uint32_t_le2host(pio_read_32(reg)); 125 } 126 static inline uint32_t pio_read_be32(const ioport32_t *reg) 127 { 128 return uint32_t_be2host(pio_read_32(reg)); 129 } 130 static inline uint64_t pio_read_le64(const ioport64_t *reg) 131 { 132 return uint64_t_le2host(pio_read_64(reg)); 133 } 134 static inline uint64_t pio_read_be64(const ioport64_t *reg) 135 { 136 return uint64_t_be2host(pio_read_64(reg)); 137 } 138 87 139 static inline uint8_t pio_change_8(ioport8_t *reg, uint8_t val, uint8_t mask, 88 140 useconds_t delay) -
uspace/lib/drv/include/pci_dev_iface.h
r2498b95 rfbfe59d 42 42 #define PCI_VENDOR_ID 0x00 43 43 #define PCI_DEVICE_ID 0x02 44 #define PCI_STATUS 0x06 44 45 #define PCI_SUB_CLASS 0x0A 45 46 #define PCI_BASE_CLASS 0x0B 47 #define PCI_BAR0 0x10 48 #define PCI_CAP_PTR 0x34 49 50 #define PCI_BAR_COUNT 6 51 52 #define PCI_STATUS_CAP_LIST (1 << 4) 53 54 #define PCI_CAP_ID(c) ((c) + 0x0) 55 #define PCI_CAP_NEXT(c) ((c) + 0x1) 56 57 #define PCI_CAP_PMID 0x1 58 #define PCI_CAP_VENDORSPECID 0x9 46 59 47 60 extern errno_t pci_config_space_read_8(async_sess_t *, uint32_t, uint8_t *); … … 52 65 extern errno_t pci_config_space_write_16(async_sess_t *, uint32_t, uint16_t); 53 66 extern errno_t pci_config_space_write_32(async_sess_t *, uint32_t, uint32_t); 67 68 static inline errno_t 69 pci_config_space_cap_first(async_sess_t *sess, uint8_t *c, uint8_t *id) 70 { 71 errno_t rc; 72 uint16_t status; 73 74 rc = pci_config_space_read_16(sess, PCI_STATUS, &status); 75 if (rc != EOK) 76 return rc; 77 78 if (!(status & PCI_STATUS_CAP_LIST)) { 79 *c = 0; 80 return EOK; 81 } 82 83 rc = pci_config_space_read_8(sess, PCI_CAP_PTR, c); 84 if (rc != EOK) 85 return rc; 86 if (!c) 87 return EOK; 88 return pci_config_space_read_8(sess, PCI_CAP_ID(*c), id); 89 } 90 91 static inline errno_t 92 pci_config_space_cap_next(async_sess_t *sess, uint8_t *c, uint8_t *id) 93 { 94 errno_t rc = pci_config_space_read_8(sess, PCI_CAP_NEXT(*c), c); 95 if (rc != EOK) 96 return rc; 97 if (!c) 98 return EOK; 99 return pci_config_space_read_8(sess, PCI_CAP_ID(*c), id); 100 } 54 101 55 102 /** PCI device communication interface. */
Note:
See TracChangeset
for help on using the changeset viewer.