Changeset 230385c in mainline


Ignore:
Timestamp:
2012-01-24T02:41:51Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
690d2e7
Parents:
948911d
Message:

pci: Setup addr port and data port separately.

We will need this for non-pc pci.

Location:
uspace/drv
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/pci/pciintel/pci.c

    r948911d r230385c  
    650650        got_res = true;
    651651       
     652       
     653        assert(hw_resources.count > 1);
     654        assert(hw_resources.resources[0].type == IO_RANGE);
     655        assert(hw_resources.resources[0].res.io_range.size >= 4);
     656       
     657        assert(hw_resources.resources[1].type == IO_RANGE);
     658        assert(hw_resources.resources[1].res.io_range.size >= 4);
     659       
    652660        ddf_msg(LVL_DEBUG, "conf_addr = %" PRIx64 ".",
    653661            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);
     662        ddf_msg(LVL_DEBUG, "data_addr = %" PRIx64 ".",
     663            hw_resources.resources[1].res.io_range.address);
    658664       
    659665        bus->conf_io_addr =
    660666            (uint32_t) hw_resources.resources[0].res.io_range.address;
    661        
    662         if (pio_enable((void *)(uintptr_t)bus->conf_io_addr, 8,
     667        bus->conf_io_data =
     668            (uint32_t) hw_resources.resources[1].res.io_range.address;
     669       
     670        if (pio_enable((void *)(uintptr_t)bus->conf_io_addr, 4,
    663671            &bus->conf_addr_port)) {
    664672                ddf_msg(LVL_ERROR, "Failed to enable configuration ports.");
     
    666674                goto fail;
    667675        }
    668         bus->conf_data_port = (char *) bus->conf_addr_port + 4;
     676        if (pio_enable((void *)(uintptr_t)bus->conf_io_data, 4,
     677            &bus->conf_data_port)) {
     678                ddf_msg(LVL_ERROR, "Failed to enable configuration ports.");
     679                rc = EADDRNOTAVAIL;
     680                goto fail;
     681        }
    669682       
    670683        /* Make the bus device more visible. It has no use yet. */
  • uspace/drv/bus/pci/pciintel/pci.h

    r948911d r230385c  
    4646        ddf_dev_t *dnode;
    4747        uint32_t conf_io_addr;
     48        uint32_t conf_io_data;
    4849        void *conf_data_port;
    4950        void *conf_addr_port;
  • uspace/drv/infrastructure/rootpc/rootpc.c

    r948911d r230385c  
    7777};
    7878
    79 static hw_resource_t pci_conf_regs = {
    80         .type = IO_RANGE,
    81         .res.io_range = {
    82                 .address = 0xCF8,
    83                 .size = 8,
    84                 .endianness = LITTLE_ENDIAN
     79static hw_resource_t pci_conf_regs[] = {
     80        {
     81                .type = IO_RANGE,
     82                .res.io_range = {
     83                        .address = 0xCF8,
     84                        .size = 4,
     85                        .endianness = LITTLE_ENDIAN
     86                }
     87        },
     88        {
     89                .type = IO_RANGE,
     90                .res.io_range = {
     91                        .address = 0xCFC,
     92                        .size = 4,
     93                        .endianness = LITTLE_ENDIAN
     94                }
    8595        }
    8696};
     
    8898static rootpc_fun_t pci_data = {
    8999        .hw_resources = {
    90                 1,
    91                 &pci_conf_regs
     100                sizeof(pci_conf_regs)/sizeof(pci_conf_regs[0]),
     101                pci_conf_regs
    92102        }
    93103};
Note: See TracChangeset for help on using the changeset viewer.