Deleted Added
full compact
ah_osdep.c (233887) ah_osdep.c (234450)
1/*-
2 * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

21 * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
22 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27 * THE POSSIBILITY OF SUCH DAMAGES.
28 *
1/*-
2 * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

21 * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
22 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27 * THE POSSIBILITY OF SUCH DAMAGES.
28 *
29 * $FreeBSD: head/sys/dev/ath/ah_osdep.c 233887 2012-04-04 20:46:20Z adrian $
29 * $FreeBSD: head/sys/dev/ath/ah_osdep.c 234450 2012-04-19 03:26:21Z adrian $
30 */
31#include "opt_ah.h"
32
33#include <sys/param.h>
34#include <sys/systm.h>
35#include <sys/kernel.h>
36#include <sys/module.h>
37#include <sys/sysctl.h>

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

262 r->op = OP_WRITE;
263 r->reg = reg;
264 r->val = val;
265 alq_post(ath_hal_alq, ale);
266 }
267 }
268 if (ah->ah_config.ah_serialise_reg_war)
269 mtx_lock_spin(&ah_regser_mtx);
30 */
31#include "opt_ah.h"
32
33#include <sys/param.h>
34#include <sys/systm.h>
35#include <sys/kernel.h>
36#include <sys/module.h>
37#include <sys/sysctl.h>

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

262 r->op = OP_WRITE;
263 r->reg = reg;
264 r->val = val;
265 alq_post(ath_hal_alq, ale);
266 }
267 }
268 if (ah->ah_config.ah_serialise_reg_war)
269 mtx_lock_spin(&ah_regser_mtx);
270#if _BYTE_ORDER == _BIG_ENDIAN
271 if (OS_REG_UNSWAPPED(reg))
272 bus_space_write_4(tag, h, reg, val);
273 else
274#endif
275 bus_space_write_stream_4(tag, h, reg, val);
270 bus_space_write_4(tag, h, reg, val);
276 if (ah->ah_config.ah_serialise_reg_war)
277 mtx_unlock_spin(&ah_regser_mtx);
278}
279
280u_int32_t
281ath_hal_reg_read(struct ath_hal *ah, u_int32_t reg)
282{
283 bus_space_tag_t tag = BUSTAG(ah);
284 bus_space_handle_t h = ah->ah_sh;
285 u_int32_t val;
286
287 if (ah->ah_config.ah_serialise_reg_war)
288 mtx_lock_spin(&ah_regser_mtx);
271 if (ah->ah_config.ah_serialise_reg_war)
272 mtx_unlock_spin(&ah_regser_mtx);
273}
274
275u_int32_t
276ath_hal_reg_read(struct ath_hal *ah, u_int32_t reg)
277{
278 bus_space_tag_t tag = BUSTAG(ah);
279 bus_space_handle_t h = ah->ah_sh;
280 u_int32_t val;
281
282 if (ah->ah_config.ah_serialise_reg_war)
283 mtx_lock_spin(&ah_regser_mtx);
289#if _BYTE_ORDER == _BIG_ENDIAN
290 if (OS_REG_UNSWAPPED(reg))
291 val = bus_space_read_4(tag, h, reg);
292 else
293#endif
294 val = bus_space_read_stream_4(tag, h, reg);
284 val = bus_space_read_4(tag, h, reg);
295 if (ah->ah_config.ah_serialise_reg_war)
296 mtx_unlock_spin(&ah_regser_mtx);
297 if (ath_hal_alq) {
298 struct ale *ale = ath_hal_alq_get(ah);
299 if (ale) {
300 struct athregrec *r = (struct athregrec *) ale->ae_data;
301 r->threadid = curthread->td_tid;
302 r->op = OP_READ;

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

338void
339ath_hal_reg_write(struct ath_hal *ah, u_int32_t reg, u_int32_t val)
340{
341 bus_space_tag_t tag = BUSTAG(ah);
342 bus_space_handle_t h = ah->ah_sh;
343
344 if (ah->ah_config.ah_serialise_reg_war)
345 mtx_lock_spin(&ah_regser_mtx);
285 if (ah->ah_config.ah_serialise_reg_war)
286 mtx_unlock_spin(&ah_regser_mtx);
287 if (ath_hal_alq) {
288 struct ale *ale = ath_hal_alq_get(ah);
289 if (ale) {
290 struct athregrec *r = (struct athregrec *) ale->ae_data;
291 r->threadid = curthread->td_tid;
292 r->op = OP_READ;

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

328void
329ath_hal_reg_write(struct ath_hal *ah, u_int32_t reg, u_int32_t val)
330{
331 bus_space_tag_t tag = BUSTAG(ah);
332 bus_space_handle_t h = ah->ah_sh;
333
334 if (ah->ah_config.ah_serialise_reg_war)
335 mtx_lock_spin(&ah_regser_mtx);
346#if _BYTE_ORDER == _BIG_ENDIAN
347 if (OS_REG_UNSWAPPED(reg))
348 bus_space_write_4(tag, h, reg, val);
349 else
350#endif
351 bus_space_write_stream_4(tag, h, reg, val);
336 bus_space_write_4(tag, h, reg, val);
352 if (ah->ah_config.ah_serialise_reg_war)
353 mtx_unlock_spin(&ah_regser_mtx);
354}
355
356u_int32_t
357ath_hal_reg_read(struct ath_hal *ah, u_int32_t reg)
358{
359 bus_space_tag_t tag = BUSTAG(ah);
360 bus_space_handle_t h = ah->ah_sh;
361 u_int32_t val;
362
363 if (ah->ah_config.ah_serialise_reg_war)
364 mtx_lock_spin(&ah_regser_mtx);
337 if (ah->ah_config.ah_serialise_reg_war)
338 mtx_unlock_spin(&ah_regser_mtx);
339}
340
341u_int32_t
342ath_hal_reg_read(struct ath_hal *ah, u_int32_t reg)
343{
344 bus_space_tag_t tag = BUSTAG(ah);
345 bus_space_handle_t h = ah->ah_sh;
346 u_int32_t val;
347
348 if (ah->ah_config.ah_serialise_reg_war)
349 mtx_lock_spin(&ah_regser_mtx);
365#if _BYTE_ORDER == _BIG_ENDIAN
366 if (OS_REG_UNSWAPPED(reg))
367 val = bus_space_read_4(tag, h, reg);
368 else
369#endif
370 val = bus_space_read_stream_4(tag, h, reg);
350 val = bus_space_read_4(tag, h, reg);
371 if (ah->ah_config.ah_serialise_reg_war)
372 mtx_unlock_spin(&ah_regser_mtx);
373 return val;
374}
375#endif /* AH_DEBUG || AH_REGOPS_FUNC */
376
377#ifdef AH_ASSERT
378void
379ath_hal_assert_failed(const char* filename, int lineno, const char *msg)
380{
381 printf("Atheros HAL assertion failure: %s: line %u: %s\n",
382 filename, lineno, msg);
383 panic("ath_hal_assert");
384}
385#endif /* AH_ASSERT */
351 if (ah->ah_config.ah_serialise_reg_war)
352 mtx_unlock_spin(&ah_regser_mtx);
353 return val;
354}
355#endif /* AH_DEBUG || AH_REGOPS_FUNC */
356
357#ifdef AH_ASSERT
358void
359ath_hal_assert_failed(const char* filename, int lineno, const char *msg)
360{
361 printf("Atheros HAL assertion failure: %s: line %u: %s\n",
362 filename, lineno, msg);
363 panic("ath_hal_assert");
364}
365#endif /* AH_ASSERT */