Changes in uspace/drv/bus/pci/pciintel/pci.c [2df6f6fe:690d2e7] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/pci/pciintel/pci.c
r2df6f6fe r690d2e7 38 38 39 39 #include <assert.h> 40 #include <byteorder.h> 40 41 #include <stdio.h> 41 42 #include <errno.h> … … 231 232 void *addr = bus->conf_data_port + (reg & 3); 232 233 233 pio_write_32(bus->conf_addr_port, conf_addr);234 pio_write_32(bus->conf_addr_port, host2uint32_t_le(conf_addr)); 234 235 235 236 switch (len) { 236 237 case 1: 238 /* No endianness change for 1 byte */ 237 239 buf[0] = pio_read_8(addr); 238 240 break; 239 241 case 2: 240 ((uint16_t *) buf)[0] = pio_read_16(addr);242 ((uint16_t *) buf)[0] = uint16_t_le2host(pio_read_16(addr)); 241 243 break; 242 244 case 4: 243 ((uint32_t *) buf)[0] = pio_read_32(addr);245 ((uint32_t *) buf)[0] = uint32_t_le2host(pio_read_32(addr)); 244 246 break; 245 247 } … … 254 256 fibril_mutex_lock(&bus->conf_mutex); 255 257 256 uint32_t conf_addr; 257 conf_addr = CONF_ADDR(fun->bus, fun->dev, fun->fn, reg); 258 const uint32_t conf_addr = CONF_ADDR(fun->bus, fun->dev, fun->fn, reg); 258 259 void *addr = bus->conf_data_port + (reg & 3); 259 260 260 pio_write_32(bus->conf_addr_port, conf_addr);261 pio_write_32(bus->conf_addr_port, host2uint32_t_le(conf_addr)); 261 262 262 263 switch (len) { 263 264 case 1: 265 /* No endianness change for 1 byte */ 264 266 pio_write_8(addr, buf[0]); 265 267 break; 266 268 case 2: 267 pio_write_16(addr, ((uint16_t *) buf)[0]);269 pio_write_16(addr, host2uint16_t_le(((uint16_t *) buf)[0])); 268 270 break; 269 271 case 4: 270 pio_write_32(addr, ((uint32_t *) buf)[0]);272 pio_write_32(addr, host2uint32_t_le(((uint32_t *) buf)[0])); 271 273 break; 272 274 } … … 650 652 got_res = true; 651 653 654 655 assert(hw_resources.count > 1); 656 assert(hw_resources.resources[0].type == IO_RANGE); 657 assert(hw_resources.resources[0].res.io_range.size >= 4); 658 659 assert(hw_resources.resources[1].type == IO_RANGE); 660 assert(hw_resources.resources[1].res.io_range.size >= 4); 661 652 662 ddf_msg(LVL_DEBUG, "conf_addr = %" PRIx64 ".", 653 663 hw_resources.resources[0].res.io_range.address); 654 655 assert(hw_resources.count > 0); 656 assert(hw_resources.resources[0].type == IO_RANGE); 657 assert(hw_resources.resources[0].res.io_range.size == 8); 664 ddf_msg(LVL_DEBUG, "data_addr = %" PRIx64 ".", 665 hw_resources.resources[1].res.io_range.address); 658 666 659 667 bus->conf_io_addr = 660 668 (uint32_t) hw_resources.resources[0].res.io_range.address; 661 662 if (pio_enable((void *)(uintptr_t)bus->conf_io_addr, 8, 669 bus->conf_io_data = 670 (uint32_t) hw_resources.resources[1].res.io_range.address; 671 672 if (pio_enable((void *)(uintptr_t)bus->conf_io_addr, 4, 663 673 &bus->conf_addr_port)) { 664 674 ddf_msg(LVL_ERROR, "Failed to enable configuration ports."); … … 666 676 goto fail; 667 677 } 668 bus->conf_data_port = (char *) bus->conf_addr_port + 4; 678 if (pio_enable((void *)(uintptr_t)bus->conf_io_data, 4, 679 &bus->conf_data_port)) { 680 ddf_msg(LVL_ERROR, "Failed to enable configuration ports."); 681 rc = EADDRNOTAVAIL; 682 goto fail; 683 } 669 684 670 685 /* Make the bus device more visible. It has no use yet. */
Note:
See TracChangeset
for help on using the changeset viewer.