bhnd.h (82725ba9bf1fd59746a4006a06f24d4d61d142f2) bhnd.h (05ed3f9063415c85e3d15f11904bac28e285e9f9)
1/*-
2 * Copyright (c) 2015-2016 Landon Fuller <landon@landonf.org>
3 * Copyright (c) 2017 The FreeBSD Foundation
4 * All rights reserved.
5 *
6 * Portions of this software were developed by Landon Fuller
7 * under sponsorship from the FreeBSD Foundation.
8 *

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

265 * the DMA engine. For example, on PCI(e) Wi-Fi chipsets, the Wi-Fi
266 * core DMA engine will (in effect) update the PCI core's DMA
267 * sbtopcitranslation base address to map the full address prior to
268 * performing a DMA transaction.
269 */
270 bhnd_addr_t addrext_mask;
271
272 /**
1/*-
2 * Copyright (c) 2015-2016 Landon Fuller <landon@landonf.org>
3 * Copyright (c) 2017 The FreeBSD Foundation
4 * All rights reserved.
5 *
6 * Portions of this software were developed by Landon Fuller
7 * under sponsorship from the FreeBSD Foundation.
8 *

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

265 * the DMA engine. For example, on PCI(e) Wi-Fi chipsets, the Wi-Fi
266 * core DMA engine will (in effect) update the PCI core's DMA
267 * sbtopcitranslation base address to map the full address prior to
268 * performing a DMA transaction.
269 */
270 bhnd_addr_t addrext_mask;
271
272 /**
273 * Translation flags (see bhnd_dma_translation_flags)
273 * Translation flags (see bhnd_dma_translation_flags).
274 */
275 uint32_t flags;
276};
277
278#define BHND_DMA_TRANSLATION_TABLE_END { 0, 0, 0, 0 }
279
280#define BHND_DMA_IS_TRANSLATION_TABLE_END(_dt) \
281 ((_dt)->base_addr == 0 && (_dt)->addr_mask == 0 && \

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

904}
905
906/**
907 * Attempt to read the BHND board identification from the bhnd bus.
908 *
909 * This relies on NVRAM access, and will fail if a valid NVRAM device cannot
910 * be found, or is not yet attached.
911 *
274 */
275 uint32_t flags;
276};
277
278#define BHND_DMA_TRANSLATION_TABLE_END { 0, 0, 0, 0 }
279
280#define BHND_DMA_IS_TRANSLATION_TABLE_END(_dt) \
281 ((_dt)->base_addr == 0 && (_dt)->addr_mask == 0 && \

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

904}
905
906/**
907 * Attempt to read the BHND board identification from the bhnd bus.
908 *
909 * This relies on NVRAM access, and will fail if a valid NVRAM device cannot
910 * be found, or is not yet attached.
911 *
912 * @param dev The parent of @p child.
913 * @param child The bhnd device requesting board info.
912 * @param dev The bhnd device requesting board info.
914 * @param[out] info On success, will be populated with the bhnd(4) device's
915 * board information.
916 *
917 * @retval 0 success
918 * @retval ENODEV No valid NVRAM source could be found.
919 * @retval non-zero If reading @p name otherwise fails, a regular unix
920 * error code will be returned.
921 */

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

981{
982 return (BHND_BUS_MAP_INTR(device_get_parent(dev), dev, intr, irq));
983}
984
985/**
986 * Unmap an bus interrupt previously mapped via bhnd_map_intr().
987 *
988 * @param dev The requesting device.
913 * @param[out] info On success, will be populated with the bhnd(4) device's
914 * board information.
915 *
916 * @retval 0 success
917 * @retval ENODEV No valid NVRAM source could be found.
918 * @retval non-zero If reading @p name otherwise fails, a regular unix
919 * error code will be returned.
920 */

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

980{
981 return (BHND_BUS_MAP_INTR(device_get_parent(dev), dev, intr, irq));
982}
983
984/**
985 * Unmap an bus interrupt previously mapped via bhnd_map_intr().
986 *
987 * @param dev The requesting device.
989 * @param intr The interrupt number being unmapped. This is equivalent to the
990 * bus resource ID for the interrupt.
988 * @param irq The interrupt value being unmapped.
991 */
992static inline void
993bhnd_unmap_intr(device_t dev, rman_res_t irq)
994{
995 return (BHND_BUS_UNMAP_INTR(device_get_parent(dev), dev, irq));
996}
997
998/**

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

1369}
1370
1371/**
1372 * Return true if @p region_num is a valid region on @p port_num of
1373 * @p type attached to @p dev.
1374 *
1375 * @param dev A bhnd bus child device.
1376 * @param type The port type being queried.
989 */
990static inline void
991bhnd_unmap_intr(device_t dev, rman_res_t irq)
992{
993 return (BHND_BUS_UNMAP_INTR(device_get_parent(dev), dev, irq));
994}
995
996/**

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

1367}
1368
1369/**
1370 * Return true if @p region_num is a valid region on @p port_num of
1371 * @p type attached to @p dev.
1372 *
1373 * @param dev A bhnd bus child device.
1374 * @param type The port type being queried.
1377 * @param port_num The port number being queried.
1378 * @param region_num The region number being queried.
1375 * @param port The port number being queried.
1376 * @param region The region number being queried.
1379 */
1380static inline bool
1377 */
1378static inline bool
1381bhnd_is_region_valid(device_t dev, bhnd_port_type type, u_int port_num,
1382 u_int region_num)
1379bhnd_is_region_valid(device_t dev, bhnd_port_type type, u_int port,
1380 u_int region)
1383{
1384 return (BHND_BUS_IS_REGION_VALID(device_get_parent(dev), dev, type,
1381{
1382 return (BHND_BUS_IS_REGION_VALID(device_get_parent(dev), dev, type,
1385 port_num, region_num));
1383 port, region));
1386}
1387
1388/**
1389 * Return the number of ports of type @p type attached to @p def.
1390 *
1391 * @param dev A bhnd bus child device.
1392 * @param type The port type being queried.
1393 */

--- 345 unchanged lines hidden ---
1384}
1385
1386/**
1387 * Return the number of ports of type @p type attached to @p def.
1388 *
1389 * @param dev A bhnd bus child device.
1390 * @param type The port type being queried.
1391 */

--- 345 unchanged lines hidden ---