source: mainline/uspace/drv/pciintel/pci.h@ 68414f4a

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 68414f4a was 68414f4a, checked in by Jiri Svoboda <jiri@…>, 14 years ago

Refactor drivers

  • Rename soft-state structures to have the simplest names
  • Use soft-state structures as a starting point instead of DDF device or function nodes
  • Convert to standard naming scheme
  • Property mode set to 100644
File size: 3.0 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 <stdlib.h>
40#include <driver.h>
41#include <malloc.h>
42
43#include "pci_regs.h"
44
45#define PCI_MAX_HW_RES 8
46
47typedef struct pci_fun_data {
48 function_t *fnode;
49
50 int bus;
51 int dev;
52 int fn;
53 int vendor_id;
54 int device_id;
55 hw_resource_list_t hw_resources;
56} pci_fun_t;
57
58typedef struct pciintel_bus {
59 /** DDF device node */
60 device_t *dnode;
61 uint32_t conf_io_addr;
62 void *conf_data_port;
63 void *conf_addr_port;
64 fibril_mutex_t conf_mutex;
65} pci_bus_t;
66
67extern void pci_fun_create_match_ids(pci_fun_t *);
68
69extern uint8_t pci_conf_read_8(pci_fun_t *, int);
70extern uint16_t pci_conf_read_16(pci_fun_t *, int);
71extern uint32_t pci_conf_read_32(pci_fun_t *, int);
72extern void pci_conf_write_8(pci_fun_t *, int, uint8_t);
73extern void pci_conf_write_16(pci_fun_t *, int, uint16_t);
74extern void pci_conf_write_32(pci_fun_t *, int, uint32_t);
75
76extern void pci_add_range(pci_fun_t *, uint64_t, size_t, bool);
77extern int pci_read_bar(pci_fun_t *, int);
78extern void pci_read_interrupt(pci_fun_t *);
79extern void pci_add_interrupt(pci_fun_t *, int);
80
81extern pci_fun_t *pci_fun_new(void);
82extern void pci_fun_init(pci_fun_t *, int, int, int);
83extern void pci_fun_delete(pci_fun_t *);
84extern void pci_fun_create_name(pci_fun_t *);
85
86extern void pci_bus_scan(pci_bus_t *, int);
87
88extern bool pci_alloc_resource_list(pci_fun_t *);
89extern void pci_clean_resource_list(pci_fun_t *);
90
91extern void pci_read_bars(pci_fun_t *);
92extern size_t pci_bar_mask_to_size(uint32_t);
93
94#endif
95
96/**
97 * @}
98 */
Note: See TracBrowser for help on using the repository browser.