pci.cc (11932:98961d1b51ca) pci.cc (13342:1ddb43f47325)
1/*
2 * Copyright (c) 2014, 2017 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 74 unchanged lines hidden (view full) ---

83 }
84
85 pkt->makeResponse();
86
87 switch(offset) {
88 case OFF_DEVICE_FEATURES:
89 DPRINTF(VIOIface, " DEVICE_FEATURES request\n");
90 assert(size == sizeof(uint32_t));
1/*
2 * Copyright (c) 2014, 2017 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 74 unchanged lines hidden (view full) ---

83 }
84
85 pkt->makeResponse();
86
87 switch(offset) {
88 case OFF_DEVICE_FEATURES:
89 DPRINTF(VIOIface, " DEVICE_FEATURES request\n");
90 assert(size == sizeof(uint32_t));
91 pkt->set(vio.deviceFeatures);
91 pkt->setLE<uint32_t>(vio.deviceFeatures);
92 break;
93
94 case OFF_GUEST_FEATURES:
95 DPRINTF(VIOIface, " GUEST_FEATURES request\n");
96 assert(size == sizeof(uint32_t));
92 break;
93
94 case OFF_GUEST_FEATURES:
95 DPRINTF(VIOIface, " GUEST_FEATURES request\n");
96 assert(size == sizeof(uint32_t));
97 pkt->set(vio.getGuestFeatures());
97 pkt->setLE<uint32_t>(vio.getGuestFeatures());
98 break;
99
100 case OFF_QUEUE_ADDRESS:
101 DPRINTF(VIOIface, " QUEUE_ADDRESS request\n");
102 assert(size == sizeof(uint32_t));
98 break;
99
100 case OFF_QUEUE_ADDRESS:
101 DPRINTF(VIOIface, " QUEUE_ADDRESS request\n");
102 assert(size == sizeof(uint32_t));
103 pkt->set(vio.getQueueAddress());
103 pkt->setLE<uint32_t>(vio.getQueueAddress());
104 break;
105
106 case OFF_QUEUE_SIZE:
107 DPRINTF(VIOIface, " QUEUE_SIZE request\n");
108 assert(size == sizeof(uint16_t));
104 break;
105
106 case OFF_QUEUE_SIZE:
107 DPRINTF(VIOIface, " QUEUE_SIZE request\n");
108 assert(size == sizeof(uint16_t));
109 pkt->set(vio.getQueueSize());
109 pkt->setLE<uint16_t>(vio.getQueueSize());
110 break;
111
112 case OFF_QUEUE_SELECT:
113 DPRINTF(VIOIface, " QUEUE_SELECT\n");
114 assert(size == sizeof(uint16_t));
110 break;
111
112 case OFF_QUEUE_SELECT:
113 DPRINTF(VIOIface, " QUEUE_SELECT\n");
114 assert(size == sizeof(uint16_t));
115 pkt->set(vio.getQueueSelect());
115 pkt->setLE<uint16_t>(vio.getQueueSelect());
116 break;
117
118 case OFF_QUEUE_NOTIFY:
119 DPRINTF(VIOIface, " QUEUE_NOTIFY request\n");
120 assert(size == sizeof(uint16_t));
116 break;
117
118 case OFF_QUEUE_NOTIFY:
119 DPRINTF(VIOIface, " QUEUE_NOTIFY request\n");
120 assert(size == sizeof(uint16_t));
121 pkt->set(queueNotify);
121 pkt->setLE<uint16_t>(queueNotify);
122 break;
123
124 case OFF_DEVICE_STATUS:
125 DPRINTF(VIOIface, " DEVICE_STATUS request\n");
126 assert(size == sizeof(uint8_t));
122 break;
123
124 case OFF_DEVICE_STATUS:
125 DPRINTF(VIOIface, " DEVICE_STATUS request\n");
126 assert(size == sizeof(uint8_t));
127 pkt->set(vio.getDeviceStatus());
127 pkt->setLE<uint8_t>(vio.getDeviceStatus());
128 break;
129
130 case OFF_ISR_STATUS: {
131 DPRINTF(VIOIface, " ISR_STATUS\n");
132 assert(size == sizeof(uint8_t));
133 const uint8_t isr_status(interruptDeliveryPending ? 1 : 0);
134 if (interruptDeliveryPending) {
135 interruptDeliveryPending = false;
136 intrClear();
137 }
128 break;
129
130 case OFF_ISR_STATUS: {
131 DPRINTF(VIOIface, " ISR_STATUS\n");
132 assert(size == sizeof(uint8_t));
133 const uint8_t isr_status(interruptDeliveryPending ? 1 : 0);
134 if (interruptDeliveryPending) {
135 interruptDeliveryPending = false;
136 intrClear();
137 }
138 pkt->set(isr_status);
138 pkt->setLE<uint8_t>(isr_status);
139 } break;
140
141 default:
142 panic("Unhandled read offset (0x%x)\n", offset);
143 }
144
145 return 0;
146}

--- 21 unchanged lines hidden (view full) ---

168 switch(offset) {
169 case OFF_DEVICE_FEATURES:
170 warn("Guest tried to write device features.");
171 break;
172
173 case OFF_GUEST_FEATURES:
174 DPRINTF(VIOIface, " WRITE GUEST_FEATURES request\n");
175 assert(size == sizeof(uint32_t));
139 } break;
140
141 default:
142 panic("Unhandled read offset (0x%x)\n", offset);
143 }
144
145 return 0;
146}

--- 21 unchanged lines hidden (view full) ---

168 switch(offset) {
169 case OFF_DEVICE_FEATURES:
170 warn("Guest tried to write device features.");
171 break;
172
173 case OFF_GUEST_FEATURES:
174 DPRINTF(VIOIface, " WRITE GUEST_FEATURES request\n");
175 assert(size == sizeof(uint32_t));
176 vio.setGuestFeatures(pkt->get());
176 vio.setGuestFeatures(pkt->getLE<uint32_t>());
177 break;
178
179 case OFF_QUEUE_ADDRESS:
180 DPRINTF(VIOIface, " WRITE QUEUE_ADDRESS\n");
181 assert(size == sizeof(uint32_t));
177 break;
178
179 case OFF_QUEUE_ADDRESS:
180 DPRINTF(VIOIface, " WRITE QUEUE_ADDRESS\n");
181 assert(size == sizeof(uint32_t));
182 vio.setQueueAddress(pkt->get());
182 vio.setQueueAddress(pkt->getLE<uint32_t>());
183 break;
184
185 case OFF_QUEUE_SIZE:
186 panic("Guest tried to write queue size.");
187 break;
188
189 case OFF_QUEUE_SELECT:
190 DPRINTF(VIOIface, " WRITE QUEUE_SELECT\n");
191 assert(size == sizeof(uint16_t));
183 break;
184
185 case OFF_QUEUE_SIZE:
186 panic("Guest tried to write queue size.");
187 break;
188
189 case OFF_QUEUE_SELECT:
190 DPRINTF(VIOIface, " WRITE QUEUE_SELECT\n");
191 assert(size == sizeof(uint16_t));
192 vio.setQueueSelect(pkt->get());
192 vio.setQueueSelect(pkt->getLE<uint16_t>());
193 break;
194
195 case OFF_QUEUE_NOTIFY:
196 DPRINTF(VIOIface, " WRITE QUEUE_NOTIFY\n");
197 assert(size == sizeof(uint16_t));
193 break;
194
195 case OFF_QUEUE_NOTIFY:
196 DPRINTF(VIOIface, " WRITE QUEUE_NOTIFY\n");
197 assert(size == sizeof(uint16_t));
198 queueNotify = pkt->get();
198 queueNotify = pkt->getLE<uint16_t>();
199 vio.onNotify(queueNotify);
200 break;
201
202 case OFF_DEVICE_STATUS: {
203 assert(size == sizeof(uint8_t));
199 vio.onNotify(queueNotify);
200 break;
201
202 case OFF_DEVICE_STATUS: {
203 assert(size == sizeof(uint8_t));
204 uint8_t status(pkt->get());
204 uint8_t status(pkt->getLE<uint8_t>());
205 DPRINTF(VIOIface, "VirtIO set status: 0x%x\n", status);
206 vio.setDeviceStatus(status);
207 } break;
208
209 case OFF_ISR_STATUS:
210 warn("Guest tried to write ISR status.");
211 break;
212

--- 20 unchanged lines hidden ---
205 DPRINTF(VIOIface, "VirtIO set status: 0x%x\n", status);
206 vio.setDeviceStatus(status);
207 } break;
208
209 case OFF_ISR_STATUS:
210 warn("Guest tried to write ISR status.");
211 break;
212

--- 20 unchanged lines hidden ---