Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


PCI updates
[palacios.git] / palacios / include / devices / pci_types.h
1 /* 
2  * This file is part of the Palacios Virtual Machine Monitor developed
3  * by the V3VEE Project with funding from the United States National 
4  * Science Foundation and the Department of Energy.  
5  *
6  * The V3VEE Project is a joint project between Northwestern University
7  * and the University of New Mexico.  You can find out more at 
8  * http://www.v3vee.org
9  *
10  * Copyright (c) 2009, Jack Lange <jarusl@cs.northwestern.edu>
11  * Copyright (c) 2009, The V3VEE Project <http://www.v3vee.org> 
12  * All rights reserved.
13  *
14  * Author:  Jack Lange 
15  *
16  * This is free software.  You are permitted to use,
17  * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
18  */
19
20 #ifndef __DEVICES_PCI_TYPES_H__
21 #define __DEVICES_PCI_TYPES_H__
22
23
24 #include <palacios/vmm_types.h>
25
26 // struct pci_device_config
27 struct pci_config_header {
28     union {
29         uint32_t reg_00;
30         struct {
31             uint16_t   vendor_id;
32             uint16_t   device_id;
33         } __attribute__((packed));
34     } __attribute__((packed));
35
36     union {
37         uint32_t reg_04;
38         struct {
39             uint16_t   command;
40             uint16_t   status;
41         } __attribute__((packed));
42     } __attribute__((packed));
43     
44         
45     union {
46         uint32_t reg_08;
47         struct {
48             uint16_t    revision;
49             uint8_t     subclass;
50             uint8_t     class;
51         } __attribute__((packed));
52     } __attribute__((packed));
53
54     union {
55         uint32_t reg_0c;
56         struct {
57             uint8_t    cache_line_size;
58             uint8_t    latency_time;
59             uint8_t    header_type; // bits 6-0: 00: other, 01: pci-pci bridge, 02: pci-cardbus; bit 7: 1=multifunction
60             uint8_t    BIST;  
61         } __attribute__((packed));
62     } __attribute__((packed));
63     
64
65     union {
66         uint32_t reg_10;
67         uint32_t   BAR0;
68     } __attribute__((packed));
69
70     union {
71         uint32_t reg_14;
72         uint32_t   BAR1;
73     } __attribute__((packed));
74
75     union {
76         uint32_t reg_18;
77         uint32_t   BAR2;
78     } __attribute__((packed));
79
80     union {
81         uint32_t reg_1c;
82         uint32_t   BAR3;
83     } __attribute__((packed));
84
85     union {
86         uint32_t reg_20;
87         uint32_t   BAR4;
88     } __attribute__((packed));
89
90     union {
91         uint32_t reg_24;
92         uint32_t   BAR5;
93     } __attribute__((packed));
94
95
96     union {
97         uint32_t reg_28;
98         uint32_t   cardbus_cis_pointer;
99     } __attribute__((packed));
100
101     union {
102         uint32_t reg_2c;
103         struct {
104             uint16_t   subsystem_vendor_id;
105             uint16_t   subsystem_id;
106         } __attribute__((packed));
107     } __attribute__((packed));
108
109     union {
110         uint32_t reg_30;
111         uint32_t expansion_rom_address;
112     } __attribute__((packed));;
113
114     union {
115         uint32_t reg_34;
116         struct {
117             uint8_t cap_ptr;  // capabilities list offset in config space
118             uint8_t rsvd1[3];
119         } __attribute__((packed));
120     } __attribute__((packed));
121
122     union {
123         uint32_t reg_38;
124         uint32_t rsvd2;
125     } __attribute__((packed));
126
127
128     union {
129         uint32_t reg_3c;
130         struct {
131             uint8_t    intr_line; // 00=none, 01=IRQ1, etc.
132             uint8_t    intr_pin;  // 00=none, otherwise INTA# to INTD#
133             uint8_t    min_grant; // min busmaster time - units of 250ns
134             uint8_t    max_latency; // units of 250ns - busmasters
135         } __attribute__((packed));
136     } __attribute__((packed));
137 } __attribute__((packed));
138
139
140 /*
141   struct pci_class_desc {
142   uint16_t class;
143   const char * desc;
144   };
145   
146   static struct pci_class_desc pci_class_descriptions[] = {
147   { 0x0100, "SCSI controller"},
148   { 0x0101, "IDE controller"},
149   { 0x0102, "Floppy controller"},
150   { 0x0103, "IPI controller"},
151   { 0x0104, "RAID controller"},
152   { 0x0106, "SATA controller"},
153   { 0x0107, "SAS controller"},
154   { 0x0180, "Storage controller"},
155   { 0x0200, "Ethernet controller"},
156   { 0x0201, "Token Ring controller"},
157   { 0x0202, "FDDI controller"},
158   { 0x0203, "ATM controller"},
159   { 0x0280, "Network controller"},
160   { 0x0300, "VGA controller"},
161   { 0x0301, "XGA controller"},
162   { 0x0302, "3D controller"},
163   { 0x0380, "Display controller"},
164   { 0x0400, "Video controller"},
165   { 0x0401, "Audio controller"},
166   { 0x0402, "Phone"},
167   { 0x0480, "Multimedia controller"},
168   { 0x0500, "RAM controller"},
169   { 0x0501, "Flash controller"},
170   { 0x0580, "Memory controller"},
171   { 0x0600, "Host bridge"},
172   { 0x0601, "ISA bridge"},
173   { 0x0602, "EISA bridge"},
174   { 0x0603, "MC bridge"},
175   { 0x0604, "PCI bridge"},
176   { 0x0605, "PCMCIA bridge"},
177   { 0x0606, "NUBUS bridge"},
178   { 0x0607, "CARDBUS bridge"},
179   { 0x0608, "RACEWAY bridge"},
180   { 0x0680, "Bridge"},
181   { 0x0c03, "USB controller"},
182   { 0, NULL}
183   };
184 */
185
186 #endif
187