glue.c revision 193974072f41a843678abf5f61979c748687e66b
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * CDDL HEADER START
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * The contents of this file are subject to the terms of the
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Common Development and Distribution License (the "License").
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * You may not use this file except in compliance with the License.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * See the License for the specific language governing permissions
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * and limitations under the License.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * When distributing Covered Code, include this CDDL HEADER in each
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * If applicable, add the following below this CDDL HEADER, with the
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * fields enclosed by brackets "[]" replaced with your own identifying
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * information: Portions Copyright [yyyy] [name of copyright owner]
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * CDDL HEADER END
193974072f41a843678abf5f61979c748687e66bSherry Moore * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Use is subject to license terms.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * This file is part of the Chelsio T1 Ethernet driver.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Copyright (C) 2003-2005 Chelsio Communications. All rights reserved.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Solaris support routines for common code part of
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Chelsio PCI Ethernet Driver.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Device specific.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw return (ddi_get32(obj->ch_hbar0, (uint32_t *)(obj->ch_bar0 + reg_val)));
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwt1_write_reg_4(ch_t *obj, uint32_t reg_val, uint32_t write_val)
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw ddi_put32(obj->ch_hbar0, (uint32_t *)(obj->ch_bar0+reg_val), write_val);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwt1_os_pci_read_config_2(ch_t *obj, uint32_t reg, uint16_t *val)
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw return (0);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwt1_os_pci_write_config_2(ch_t *obj, uint32_t reg, uint16_t val)
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw return (0);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwt1_os_pci_read_config_4(ch_t *obj, uint32_t reg, uint32_t *val)
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw return (0);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwt1_os_pci_write_config_4(ch_t *obj, uint32_t reg, uint32_t val)
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw return (0);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw/* ARGSUSED */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwpe_os_mem_copy(ch_t *obj, void *dst, void *src, size_t len)
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw return (0);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* don't support TRASPARENT ioctls */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * sanity checks. There should be a M_DATA mblk following
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * the initial M_IOCTL mblk
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* now process the ioctl */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* protect against bad addr values */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* protect against bad addr values */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw pe->pe_reg_val = reg = pci_config_get32(chp->ch_hpci, pe->addr);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw pci_config_put32(chp->ch_hpci, pe->addr, pe->pe_reg_val);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* protect against bad addr values */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* protect against bad addr values */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Can't wait for memory here, since we have to use the Solaris dma
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * mechanisms to determine the physical address.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * flg is either 0 (read) or DMA_OUT (write).
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwpe_os_malloc_contig_wait_zero(ch_t *chp, size_t len, uint64_t *dma_addr,
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * byte swap, consistant mapping & 4k aligned
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw mem = ch_alloc_dma_mem(chp, 1, DMA_4KALN|flg, len, &pa, dh, ah);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw return (0);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw return ((void *)mem);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw/* ARGSUSED */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwpe_os_free_contig(ch_t *obj, size_t len, void *addr, uint64_t dma_addr,
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw CH_ALERT("%s: encountered fatal error, operation suspended\n",
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* format buf using fmt and arguments contained in ap */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* pass formatted string to cmn_err(9F) */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* format buf using fmt and arguments contained in ap */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* pass formatted string to cmn_err(9F) */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* format buf using fmt and arguments contained in ap */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* pass formatted string to cmn_err(9F) */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * This function initializes a polling routine, Poll_func
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * which will be polled ever N Microsecond, where N is
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * provided in the cyclic start routine.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw/* ARGSUSED */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Cyclic function which provides a periodic polling
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * capability to Solaris. The poll function provided by
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * the 'ch_init_cyclic' function is called from this
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * here, and this routine launches a new one-shot
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * timer to bring it back in some period later.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * The 'ch_start_cyclic' starts the polling.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwch_start_cyclic(p_ch_cyclic_t cyclic, unsigned long period)
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * The 'ch_stop_cyclic' stops the polling.