source: mainline/uspace/drv/bus/pci/pciintel/pci.h@ 27b0ea0

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 27b0ea0 was 92d5279, checked in by Jakub Jermar <jakub@…>, 9 years ago

pciintel: Support alternate method to access PCI configuration space

On UltraSPARC IIi-based machines, the PCI configuration space is mapped
directly in the portion of the PBM (PCI Bus Interface Module) address
space. It is therefore not accessed indirectly via the config address
and config data registers but directly by accessing the respective
portion of the PBM address space.

  • Property mode set to 100644
File size: 3.2 KB
Line 
1/*
2 * Copyright (c) 2010 Lenka Trochtova
3 * Copyright (c) 2011 Jiri Svoboda
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * - Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * - Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * - The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30/** @addtogroup pciintel
31 * @{
32 */
33/** @file
34 */
35
36#ifndef PCI_H_
37#define PCI_H_
38
39#include <ddf/driver.h>
40#include "pci_regs.h"
41
42#define PCI_MAX_HW_RES 10
43
44typedef struct pciintel_bus {
45 /** DDF device node */
46 ddf_dev_t *dnode;
47 ioport32_t *conf_addr_reg;
48 ioport32_t *conf_data_reg;
49 ioport32_t *conf_space;
50 pio_window_t pio_win;
51 fibril_mutex_t conf_mutex;
52} pci_bus_t;
53
54typedef struct pci_fun_data {
55 pci_bus_t *busptr;
56 ddf_fun_t *fnode;
57
58 int bus;
59 int dev;
60 int fn;
61 uint16_t vendor_id;
62 uint16_t device_id;
63 uint16_t command;
64 uint8_t class_code;
65 uint8_t subclass_code;
66 uint8_t prog_if;
67 uint8_t revision;
68 hw_resource_list_t hw_resources;
69 hw_resource_t resources[PCI_MAX_HW_RES];
70 pio_window_t pio_window;
71} pci_fun_t;
72
73extern void pci_fun_create_match_ids(pci_fun_t *);
74
75extern uint8_t pci_conf_read_8(pci_fun_t *, int);
76extern uint16_t pci_conf_read_16(pci_fun_t *, int);
77extern uint32_t pci_conf_read_32(pci_fun_t *, int);
78extern void pci_conf_write_8(pci_fun_t *, int, uint8_t);
79extern void pci_conf_write_16(pci_fun_t *, int, uint16_t);
80extern void pci_conf_write_32(pci_fun_t *, int, uint32_t);
81
82extern void pci_add_range(pci_fun_t *, uint64_t, size_t, bool);
83extern int pci_read_bar(pci_fun_t *, int);
84extern void pci_read_interrupt(pci_fun_t *);
85extern void pci_add_interrupt(pci_fun_t *, int);
86
87extern pci_fun_t *pci_fun_new(pci_bus_t *);
88extern void pci_fun_init(pci_fun_t *, int, int, int);
89extern void pci_fun_delete(pci_fun_t *);
90extern char *pci_fun_create_name(pci_fun_t *);
91
92extern void pci_bus_scan(pci_bus_t *, int);
93
94extern bool pci_alloc_resource_list(pci_fun_t *);
95extern void pci_clean_resource_list(pci_fun_t *);
96
97extern void pci_read_bars(pci_fun_t *);
98extern size_t pci_bar_mask_to_size(uint32_t);
99
100#endif
101
102/**
103 * @}
104 */
Note: See TracBrowser for help on using the repository browser.