2
2
* Linux OS Independent Layer
4
* Copyright 2008, Broadcom Corporation
4
* Copyright (C) 2010, Broadcom Corporation
5
5
* All Rights Reserved.
7
* Unless you and Broadcom execute a separate written software license
8
* agreement governing use of this software, this software is licensed to you
9
* under the terms of the GNU General Public License version 2, available at
10
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html (the "GPL"), with the
11
* following added to such license:
12
* As a special exception, the copyright holders of this software give you
13
* permission to link this software with independent modules, regardless of the
14
* license terms of these independent modules, and to copy and distribute the
15
* resulting executable under terms of your choice, provided that you also meet,
16
* for each linked independent module, the terms and conditions of the license
17
* of that module. An independent module is a module which is not derived from
20
7
* THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
21
8
* KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
22
9
* SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
23
10
* FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
25
* $Id: linux_osl.c,v 1.127.2.18 2009/02/26 17:07:07 Exp $
12
* $Id: linux_osl.c,v 1.152.18.5.4.1 2009/11/13 00:32:19 Exp $
59
57
bcm_mem_link_t *dbgmem_list;
62
bool g_assert_bypass = FALSE;
60
uint32 g_assert_type = 0;
64
static int16 linuxbcmerrormap[] = \
62
static int16 linuxbcmerrormap[] =
356
osl_dma_alloc_consistent(osl_t *osh, uint size, ulong *pap)
355
osl_dma_alloc_consistent(osl_t *osh, uint size, uint16 align_bits, uint *alloced, ulong *pap)
357
uint16 align = (1 << align_bits);
358
358
ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC)));
360
if (!ISALIGNED(DMA_CONSISTENT_ALIGN, align))
360
364
return (pci_alloc_consistent(osh->pdev, size, (dma_addr_t*)pap));
372
376
osl_dma_map(osl_t *osh, void *va, uint size, int direction)
374
380
ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC)));
376
if (direction == DMA_TX)
377
return (pci_map_single(osh->pdev, va, size, PCI_DMA_TODEVICE));
379
return (pci_map_single(osh->pdev, va, size, PCI_DMA_FROMDEVICE));
381
dir = (direction == DMA_TX)? PCI_DMA_TODEVICE: PCI_DMA_FROMDEVICE;
382
return (pci_map_single(osh->pdev, va, size, dir));
395
397
osl_assert(char *exp, char *file, int line)
397
399
char tempbuf[256];
402
basename = strrchr(file, '/');
398
410
#ifdef BCMDBG_ASSERT
399
snprintf(tempbuf, 256, "assertion \"%s\" failed: file \"%s\", line %d\n", exp, file, line);
411
snprintf(tempbuf, 256, "assertion \"%s\" failed: file \"%s\", line %d\n",
412
exp, basename, line);
401
414
if (!in_interrupt()) {
402
415
const int delay = 3;
758
783
return (void *)pkt;
787
osl_os_open_image(char *filename)
791
fp = filp_open(filename, O_RDONLY, 0);
800
osl_os_get_image_block(char *buf, int len, void *image)
802
struct file *fp = (struct file *)image;
808
rdlen = kernel_read(fp, fp->f_pos, buf, len);
816
osl_os_close_image(void *image)
819
filp_close((struct file *)image, NULL);