29 #include <linux/slab.h>
36 return bc_dec_reg_rd(adp, (0x00380000 | (mem_off & 0x0007FFFF)));
42 bc_dec_reg_wr(adp, (0x00380000 | (mem_off & 0x0007FFFF)), val);
52 unsigned long flags = 0;
64 spin_unlock_irqrestore(&adp->
lock, flags);
71 unsigned long flags = 0;
82 spin_unlock_irqrestore(&adp->
lock, flags);
87 unsigned long flags = 0;
96 memset(temp, 0,
sizeof(*temp));
98 spin_unlock_irqrestore(&adp->
lock, flags);
104 unsigned long flags = 0;
111 spin_unlock_irqrestore(&adp->
lock, flags);
115 unsigned int len,
unsigned int offset)
117 sg_set_page(sg, page, len, offset);
119 sg->dma_length = len;
145 BCMLOG_ERR(
"dec_rd_reg_off outof range: 0x%08x\n", reg_off);
168 BCMLOG_ERR(
"dec_wr_reg_off outof range: 0x%08x\n", reg_off);
191 BCMLOG_ERR(
"link_rd_reg_off outof range: 0x%08x\n", reg_off);
214 BCMLOG_ERR(
"link_wr_reg_off outof range: 0x%08x\n", reg_off);
237 if (!adp || !rd_buff ||
242 for (ix = 0; ix < dw_cnt; ix++)
243 rd_buff[ix] = crystalhd_dram_rd(adp, (start_off + (ix * 4)));
265 if (!adp || !wr_buff ||
271 for (ix = 0; ix < dw_cnt; ix++)
272 crystalhd_dram_wr(adp, (start_off + (ix * 4)), wr_buff[ix]);
301 rc = pci_read_config_byte(adp->
pdev, off, (
u8 *)val);
304 rc = pci_read_config_word(adp->
pdev, off, (
u16 *)val);
307 rc = pci_read_config_dword(adp->
pdev, off, (
u32 *)val);
346 rc = pci_write_config_byte(adp->
pdev, off, (
u8)val);
349 rc = pci_write_config_word(adp->
pdev, off, (
u16)val);
352 rc = pci_write_config_dword(adp->
pdev, off, val);
384 if (!adp || !sz || !phy_addr) {
410 if (!adp || !ka || !sz || !phy_addr) {
437 if (!adp || !dioq_hnd) {
503 unsigned long flags = 0;
511 tmp = crystalhd_alloc_elem(ioq->
adp);
522 tmp->
flink->blink = tmp;
523 tmp->
blink->flink = tmp;
525 spin_unlock_irqrestore(&ioq->
lock, flags);
544 unsigned long flags = 0;
562 spin_unlock_irqrestore(&ioq->
lock, flags);
565 crystalhd_free_elem(ioq->
adp, ret);
582 unsigned long flags = 0;
595 if (tmp->
tag == tag) {
604 spin_unlock_irqrestore(&ioq->
lock, flags);
608 crystalhd_free_elem(ioq->
adp, ret);
628 unsigned long flags = 0;
640 spin_unlock_irqrestore(&ioq->
lock, flags);
645 }
else if (rc == -
EINTR) {
653 spin_unlock_irqrestore(&ioq->
lock, flags);
677 bool en_422mode,
bool dir_tx,
683 unsigned long spsz = 0, uv_start = 0;
684 int i = 0,
rw = 0,
res = 0, nr_pages = 0, skip_fb_sg = 0;
686 if (!adp || !ubuff || !ubuff_sz || !dio_hnd) {
702 dio = crystalhd_alloc_dio(adp);
729 dio->
fb_size = ubuff_sz & 0x03;
735 BCMLOG_ERR(
"failed %d to copy %u fill bytes from %p\n",
750 if (
res < nr_pages) {
765 dio->
sg[0].dma_length = dio->
sg[0].length;
768 for (i = 1; i < nr_pages; i++) {
776 crystalhd_set_sg(&dio->
sg[i], dio->
pages[i], spsz, 0);
787 dio->
sg[0].dma_length = dio->
sg[0].length;
797 if (dio->
sg_cnt && skip_fb_sg)
801 dio->
uinfo.xfr_len = ubuff_sz;
802 dio->
uinfo.xfr_buff = ubuff;
803 dio->
uinfo.uv_offset = uv_offset;
804 dio->
uinfo.b422mode = en_422mode;
805 dio->
uinfo.dir_tx = dir_tx;
833 for (j = 0; j < dio->
page_cnt; j++) {
836 if (!PageReserved(page) &&
846 crystalhd_free_dio(adp, dio);
868 if (!adp || !max_pages) {
877 BCMLOG_ERR(
"failed to create fill byte pool\n");
882 asz = (
sizeof(*dio->
pages) * max_pages) +
883 (
sizeof(*dio->
sg) * max_pages) +
sizeof(*dio);
890 if ((temp) ==
NULL) {
896 temp +=
sizeof(*dio);
898 temp += (
sizeof(*dio->
pages) * max_pages);
908 crystalhd_free_dio(adp, dio);
934 dio = crystalhd_alloc_dio(adp);
969 if (!adp || !pool_size)
972 for (i = 0; i < pool_size; i++) {
978 crystalhd_free_elem(adp, temp);
1002 temp = crystalhd_alloc_elem(adp);
1017 for (i = 0; i < dwcount; i++) {
1026 if ((i == dwcount - 1) || (k > 4)) {