Changeset 6dbc500 in mainline


Ignore:
Timestamp:
2013-09-11T17:35:28Z (11 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0a428943
Parents:
65ac220
Message:

PIO_WINDOW_DEV_IFACE support for pciintel.

Location:
uspace/drv/bus/pci/pciintel
Files:
2 edited

Legend:

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

    r65ac220 r6dbc500  
    5757#include <ops/hw_res.h>
    5858#include <device/hw_res.h>
     59#include <ops/pio_window.h>
     60#include <device/pio_window.h>
    5961#include <ddi.h>
    6062#include <pci_dev_iface.h>
     
    141143}
    142144
     145static 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
    143155static int pci_config_space_write_32(ddf_fun_t *fun, uint32_t address,
    144156    uint32_t data)
     
    198210        .get_resource_list = &pciintel_get_resources,
    199211        .enable_interrupt = &pciintel_enable_interrupt,
     212};
     213
     214static pio_window_ops_t pciintel_pio_window_ops = {
     215        .get_pio_window = &pciintel_get_pio_window
    200216};
    201217
     
    211227static ddf_dev_ops_t pci_fun_ops = {
    212228        .interfaces[HW_RES_DEV_IFACE] = &pciintel_hw_res_ops,
     229        .interfaces[PIO_WINDOW_DEV_IFACE] = &pciintel_pio_window_ops,
    213230        .interfaces[PCI_DEV_IFACE] = &pci_dev_ops
    214231};
     
    617634                        pci_read_bars(fun);
    618635                        pci_read_interrupt(fun);
     636
     637                        /* Propagate the PIO window to the function. */
     638                        fun->pio_window = bus->pio_win;
    619639                       
    620640                        ddf_fun_set_ops(fun->fnode, &pci_fun_ops);
     
    647667static int pci_dev_add(ddf_dev_t *dnode)
    648668{
     669        hw_resource_list_t hw_resources;
    649670        pci_bus_t *bus = NULL;
    650671        ddf_fun_t *ctl = NULL;
     
    672693                goto fail;
    673694        }
    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        }
    676702       
    677703        rc = hw_res_get_resource_list(sess, &hw_resources);
     
    763789{
    764790        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;
    767791}
    768792
  • uspace/drv/bus/pci/pciintel/pci.h

    r65ac220 r6dbc500  
    4040#include "pci_regs.h"
    4141
    42 #define PCI_MAX_HW_RES 8
     42#define PCI_MAX_HW_RES 10
    4343
    4444typedef struct pciintel_bus {
     
    4949        void *conf_data_port;
    5050        void *conf_addr_port;
     51        pio_window_t pio_win;
    5152        fibril_mutex_t conf_mutex;
    5253} pci_bus_t;
     
    6869        hw_resource_list_t hw_resources;
    6970        hw_resource_t resources[PCI_MAX_HW_RES];
     71        pio_window_t pio_window;
    7072} pci_fun_t;
    7173
Note: See TracChangeset for help on using the changeset viewer.