summaryrefslogtreecommitdiffstats
path: root/recipes-devtools/qemu/qemu-zynqmp-mainline/0009-char-cadence_uart-Clean-up-variable-names.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-devtools/qemu/qemu-zynqmp-mainline/0009-char-cadence_uart-Clean-up-variable-names.patch')
-rw-r--r--recipes-devtools/qemu/qemu-zynqmp-mainline/0009-char-cadence_uart-Clean-up-variable-names.patch334
1 files changed, 0 insertions, 334 deletions
diff --git a/recipes-devtools/qemu/qemu-zynqmp-mainline/0009-char-cadence_uart-Clean-up-variable-names.patch b/recipes-devtools/qemu/qemu-zynqmp-mainline/0009-char-cadence_uart-Clean-up-variable-names.patch
deleted file mode 100644
index d94b23ad..00000000
--- a/recipes-devtools/qemu/qemu-zynqmp-mainline/0009-char-cadence_uart-Clean-up-variable-names.patch
+++ /dev/null
@@ -1,334 +0,0 @@
1From 7f5e56c8f0a8393b9cb930883059d873802338c6 Mon Sep 17 00:00:00 2001
2From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
3Date: Mon, 23 Mar 2015 04:05:16 -0700
4Subject: [PATCH 09/15] char: cadence_uart: Clean up variable names
5
6In preparation for migrating the state struct and type cast macro to a public
7header. The acronym "UART" on it's own is not specific enough to be used in a
8more global namespace so preface with "cadence". Fix the capitalisation of
9"uart" in the state type while touching the typename. Preface macros
10used by the state struct itself with CADENCE_UART so they don't conflict
11in namespace either.
12
13Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
14Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
15---
16 hw/char/cadence_uart.c | 102 +++++++++++++++++++++++++-----------------------
17 1 file changed, 54 insertions(+), 48 deletions(-)
18
19diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c
20index d145378..4a4d3eb 100644
21--- a/hw/char/cadence_uart.c
22+++ b/hw/char/cadence_uart.c
23@@ -85,8 +85,8 @@
24 #define LOCAL_LOOPBACK (0x2 << UART_MR_CHMODE_SH)
25 #define REMOTE_LOOPBACK (0x3 << UART_MR_CHMODE_SH)
26
27-#define RX_FIFO_SIZE 16
28-#define TX_FIFO_SIZE 16
29+#define CADENCE_UART_RX_FIFO_SIZE 16
30+#define CADENCE_UART_TX_FIFO_SIZE 16
31 #define UART_INPUT_CLK 50000000
32
33 #define R_CR (0x00/4)
34@@ -108,10 +108,11 @@
35 #define R_PWID (0x40/4)
36 #define R_TTRIG (0x44/4)
37
38-#define R_MAX (R_TTRIG + 1)
39+#define CADENCE_UART_R_MAX (0x48/4)
40
41 #define TYPE_CADENCE_UART "cadence_uart"
42-#define CADENCE_UART(obj) OBJECT_CHECK(UartState, (obj), TYPE_CADENCE_UART)
43+#define CADENCE_UART(obj) OBJECT_CHECK(CadenceUARTState, (obj), \
44+ TYPE_CADENCE_UART)
45
46 typedef struct {
47 /*< private >*/
48@@ -119,9 +120,9 @@ typedef struct {
49 /*< public >*/
50
51 MemoryRegion iomem;
52- uint32_t r[R_MAX];
53- uint8_t rx_fifo[RX_FIFO_SIZE];
54- uint8_t tx_fifo[TX_FIFO_SIZE];
55+ uint32_t r[CADENCE_UART_R_MAX];
56+ uint8_t rx_fifo[CADENCE_UART_RX_FIFO_SIZE];
57+ uint8_t tx_fifo[CADENCE_UART_TX_FIFO_SIZE];
58 uint32_t rx_wpos;
59 uint32_t rx_count;
60 uint32_t tx_count;
61@@ -129,17 +130,19 @@ typedef struct {
62 CharDriverState *chr;
63 qemu_irq irq;
64 QEMUTimer *fifo_trigger_handle;
65-} UartState;
66+} CadenceUARTState;
67
68-static void uart_update_status(UartState *s)
69+static void uart_update_status(CadenceUARTState *s)
70 {
71 s->r[R_SR] = 0;
72
73- s->r[R_SR] |= s->rx_count == RX_FIFO_SIZE ? UART_SR_INTR_RFUL : 0;
74+ s->r[R_SR] |= s->rx_count == CADENCE_UART_RX_FIFO_SIZE ? UART_SR_INTR_RFUL
75+ : 0;
76 s->r[R_SR] |= !s->rx_count ? UART_SR_INTR_REMPTY : 0;
77 s->r[R_SR] |= s->rx_count >= s->r[R_RTRIG] ? UART_SR_INTR_RTRIG : 0;
78
79- s->r[R_SR] |= s->tx_count == TX_FIFO_SIZE ? UART_SR_INTR_TFUL : 0;
80+ s->r[R_SR] |= s->tx_count == CADENCE_UART_TX_FIFO_SIZE ? UART_SR_INTR_TFUL
81+ : 0;
82 s->r[R_SR] |= !s->tx_count ? UART_SR_INTR_TEMPTY : 0;
83 s->r[R_SR] |= s->tx_count >= s->r[R_TTRIG] ? UART_SR_TTRIG : 0;
84
85@@ -150,14 +153,14 @@ static void uart_update_status(UartState *s)
86
87 static void fifo_trigger_update(void *opaque)
88 {
89- UartState *s = (UartState *)opaque;
90+ CadenceUARTState *s = opaque;
91
92 s->r[R_CISR] |= UART_INTR_TIMEOUT;
93
94 uart_update_status(s);
95 }
96
97-static void uart_rx_reset(UartState *s)
98+static void uart_rx_reset(CadenceUARTState *s)
99 {
100 s->rx_wpos = 0;
101 s->rx_count = 0;
102@@ -166,12 +169,12 @@ static void uart_rx_reset(UartState *s)
103 }
104 }
105
106-static void uart_tx_reset(UartState *s)
107+static void uart_tx_reset(CadenceUARTState *s)
108 {
109 s->tx_count = 0;
110 }
111
112-static void uart_send_breaks(UartState *s)
113+static void uart_send_breaks(CadenceUARTState *s)
114 {
115 int break_enabled = 1;
116
117@@ -181,7 +184,7 @@ static void uart_send_breaks(UartState *s)
118 }
119 }
120
121-static void uart_parameters_setup(UartState *s)
122+static void uart_parameters_setup(CadenceUARTState *s)
123 {
124 QEMUSerialSetParams ssp;
125 unsigned int baud_rate, packet_size;
126@@ -236,20 +239,20 @@ static void uart_parameters_setup(UartState *s)
127
128 static int uart_can_receive(void *opaque)
129 {
130- UartState *s = (UartState *)opaque;
131- int ret = MAX(RX_FIFO_SIZE, TX_FIFO_SIZE);
132+ CadenceUARTState *s = opaque;
133+ int ret = MAX(CADENCE_UART_RX_FIFO_SIZE, CADENCE_UART_TX_FIFO_SIZE);
134 uint32_t ch_mode = s->r[R_MR] & UART_MR_CHMODE;
135
136 if (ch_mode == NORMAL_MODE || ch_mode == ECHO_MODE) {
137- ret = MIN(ret, RX_FIFO_SIZE - s->rx_count);
138+ ret = MIN(ret, CADENCE_UART_RX_FIFO_SIZE - s->rx_count);
139 }
140 if (ch_mode == REMOTE_LOOPBACK || ch_mode == ECHO_MODE) {
141- ret = MIN(ret, TX_FIFO_SIZE - s->tx_count);
142+ ret = MIN(ret, CADENCE_UART_TX_FIFO_SIZE - s->tx_count);
143 }
144 return ret;
145 }
146
147-static void uart_ctrl_update(UartState *s)
148+static void uart_ctrl_update(CadenceUARTState *s)
149 {
150 if (s->r[R_CR] & UART_CR_TXRST) {
151 uart_tx_reset(s);
152@@ -268,7 +271,7 @@ static void uart_ctrl_update(UartState *s)
153
154 static void uart_write_rx_fifo(void *opaque, const uint8_t *buf, int size)
155 {
156- UartState *s = (UartState *)opaque;
157+ CadenceUARTState *s = opaque;
158 uint64_t new_rx_time = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
159 int i;
160
161@@ -276,12 +279,12 @@ static void uart_write_rx_fifo(void *opaque, const uint8_t *buf, int size)
162 return;
163 }
164
165- if (s->rx_count == RX_FIFO_SIZE) {
166+ if (s->rx_count == CADENCE_UART_RX_FIFO_SIZE) {
167 s->r[R_CISR] |= UART_INTR_ROVR;
168 } else {
169 for (i = 0; i < size; i++) {
170 s->rx_fifo[s->rx_wpos] = buf[i];
171- s->rx_wpos = (s->rx_wpos + 1) % RX_FIFO_SIZE;
172+ s->rx_wpos = (s->rx_wpos + 1) % CADENCE_UART_RX_FIFO_SIZE;
173 s->rx_count++;
174 }
175 timer_mod(s->fifo_trigger_handle, new_rx_time +
176@@ -293,7 +296,7 @@ static void uart_write_rx_fifo(void *opaque, const uint8_t *buf, int size)
177 static gboolean cadence_uart_xmit(GIOChannel *chan, GIOCondition cond,
178 void *opaque)
179 {
180- UartState *s = opaque;
181+ CadenceUARTState *s = opaque;
182 int ret;
183
184 /* instant drain the fifo when there's no back-end */
185@@ -320,14 +323,15 @@ static gboolean cadence_uart_xmit(GIOChannel *chan, GIOCondition cond,
186 return FALSE;
187 }
188
189-static void uart_write_tx_fifo(UartState *s, const uint8_t *buf, int size)
190+static void uart_write_tx_fifo(CadenceUARTState *s, const uint8_t *buf,
191+ int size)
192 {
193 if ((s->r[R_CR] & UART_CR_TX_DIS) || !(s->r[R_CR] & UART_CR_TX_EN)) {
194 return;
195 }
196
197- if (size > TX_FIFO_SIZE - s->tx_count) {
198- size = TX_FIFO_SIZE - s->tx_count;
199+ if (size > CADENCE_UART_TX_FIFO_SIZE - s->tx_count) {
200+ size = CADENCE_UART_TX_FIFO_SIZE - s->tx_count;
201 /*
202 * This can only be a guest error via a bad tx fifo register push,
203 * as can_receive() should stop remote loop and echo modes ever getting
204@@ -345,7 +349,7 @@ static void uart_write_tx_fifo(UartState *s, const uint8_t *buf, int size)
205
206 static void uart_receive(void *opaque, const uint8_t *buf, int size)
207 {
208- UartState *s = (UartState *)opaque;
209+ CadenceUARTState *s = opaque;
210 uint32_t ch_mode = s->r[R_MR] & UART_MR_CHMODE;
211
212 if (ch_mode == NORMAL_MODE || ch_mode == ECHO_MODE) {
213@@ -358,7 +362,7 @@ static void uart_receive(void *opaque, const uint8_t *buf, int size)
214
215 static void uart_event(void *opaque, int event)
216 {
217- UartState *s = (UartState *)opaque;
218+ CadenceUARTState *s = opaque;
219 uint8_t buf = '\0';
220
221 if (event == CHR_EVENT_BREAK) {
222@@ -368,15 +372,15 @@ static void uart_event(void *opaque, int event)
223 uart_update_status(s);
224 }
225
226-static void uart_read_rx_fifo(UartState *s, uint32_t *c)
227+static void uart_read_rx_fifo(CadenceUARTState *s, uint32_t *c)
228 {
229 if ((s->r[R_CR] & UART_CR_RX_DIS) || !(s->r[R_CR] & UART_CR_RX_EN)) {
230 return;
231 }
232
233 if (s->rx_count) {
234- uint32_t rx_rpos =
235- (RX_FIFO_SIZE + s->rx_wpos - s->rx_count) % RX_FIFO_SIZE;
236+ uint32_t rx_rpos = (CADENCE_UART_RX_FIFO_SIZE + s->rx_wpos -
237+ s->rx_count) % CADENCE_UART_RX_FIFO_SIZE;
238 *c = s->rx_fifo[rx_rpos];
239 s->rx_count--;
240
241@@ -393,7 +397,7 @@ static void uart_read_rx_fifo(UartState *s, uint32_t *c)
242 static void uart_write(void *opaque, hwaddr offset,
243 uint64_t value, unsigned size)
244 {
245- UartState *s = (UartState *)opaque;
246+ CadenceUARTState *s = opaque;
247
248 DB_PRINT(" offset:%x data:%08x\n", (unsigned)offset, (unsigned)value);
249 offset >>= 2;
250@@ -437,11 +441,11 @@ static void uart_write(void *opaque, hwaddr offset,
251 static uint64_t uart_read(void *opaque, hwaddr offset,
252 unsigned size)
253 {
254- UartState *s = (UartState *)opaque;
255+ CadenceUARTState *s = opaque;
256 uint32_t c = 0;
257
258 offset >>= 2;
259- if (offset >= R_MAX) {
260+ if (offset >= CADENCE_UART_R_MAX) {
261 c = 0;
262 } else if (offset == R_TX_RX) {
263 uart_read_rx_fifo(s, &c);
264@@ -461,7 +465,7 @@ static const MemoryRegionOps uart_ops = {
265
266 static void cadence_uart_reset(DeviceState *dev)
267 {
268- UartState *s = CADENCE_UART(dev);
269+ CadenceUARTState *s = CADENCE_UART(dev);
270
271 s->r[R_CR] = 0x00000128;
272 s->r[R_IMR] = 0;
273@@ -478,7 +482,7 @@ static void cadence_uart_reset(DeviceState *dev)
274
275 static void cadence_uart_realize(DeviceState *dev, Error **errp)
276 {
277- UartState *s = CADENCE_UART(dev);
278+ CadenceUARTState *s = CADENCE_UART(dev);
279
280 s->fifo_trigger_handle = timer_new_ns(QEMU_CLOCK_VIRTUAL,
281 fifo_trigger_update, s);
282@@ -495,7 +499,7 @@ static void cadence_uart_realize(DeviceState *dev, Error **errp)
283 static void cadence_uart_init(Object *obj)
284 {
285 SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
286- UartState *s = CADENCE_UART(obj);
287+ CadenceUARTState *s = CADENCE_UART(obj);
288
289 memory_region_init_io(&s->iomem, obj, &uart_ops, s, "uart", 0x1000);
290 sysbus_init_mmio(sbd, &s->iomem);
291@@ -506,7 +510,7 @@ static void cadence_uart_init(Object *obj)
292
293 static int cadence_uart_post_load(void *opaque, int version_id)
294 {
295- UartState *s = opaque;
296+ CadenceUARTState *s = opaque;
297
298 uart_parameters_setup(s);
299 uart_update_status(s);
300@@ -519,13 +523,15 @@ static const VMStateDescription vmstate_cadence_uart = {
301 .minimum_version_id = 2,
302 .post_load = cadence_uart_post_load,
303 .fields = (VMStateField[]) {
304- VMSTATE_UINT32_ARRAY(r, UartState, R_MAX),
305- VMSTATE_UINT8_ARRAY(rx_fifo, UartState, RX_FIFO_SIZE),
306- VMSTATE_UINT8_ARRAY(tx_fifo, UartState, RX_FIFO_SIZE),
307- VMSTATE_UINT32(rx_count, UartState),
308- VMSTATE_UINT32(tx_count, UartState),
309- VMSTATE_UINT32(rx_wpos, UartState),
310- VMSTATE_TIMER_PTR(fifo_trigger_handle, UartState),
311+ VMSTATE_UINT32_ARRAY(r, CadenceUARTState, CADENCE_UART_R_MAX),
312+ VMSTATE_UINT8_ARRAY(rx_fifo, CadenceUARTState,
313+ CADENCE_UART_RX_FIFO_SIZE),
314+ VMSTATE_UINT8_ARRAY(tx_fifo, CadenceUARTState,
315+ CADENCE_UART_TX_FIFO_SIZE),
316+ VMSTATE_UINT32(rx_count, CadenceUARTState),
317+ VMSTATE_UINT32(tx_count, CadenceUARTState),
318+ VMSTATE_UINT32(rx_wpos, CadenceUARTState),
319+ VMSTATE_TIMER_PTR(fifo_trigger_handle, CadenceUARTState),
320 VMSTATE_END_OF_LIST()
321 }
322 };
323@@ -544,7 +550,7 @@ static void cadence_uart_class_init(ObjectClass *klass, void *data)
324 static const TypeInfo cadence_uart_info = {
325 .name = TYPE_CADENCE_UART,
326 .parent = TYPE_SYS_BUS_DEVICE,
327- .instance_size = sizeof(UartState),
328+ .instance_size = sizeof(CadenceUARTState),
329 .instance_init = cadence_uart_init,
330 .class_init = cadence_uart_class_init,
331 };
332--
3331.7.10.4
334