Deleted Added
sdiff udiff text old ( 233887 ) new ( 234450 )
full compact
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 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);
270 bus_space_write_4(tag, h, reg, val);
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);
284 val = bus_space_read_4(tag, h, reg);
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);
336 bus_space_write_4(tag, h, reg, val);
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);
350 val = bus_space_read_4(tag, h, reg);
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 */