1/* $Id: nic.h,v 1.1.1.1 2008/10/15 03:27:17 james26_jang Exp $ 2 * 3 * This file is subject to the terms and conditions of the GNU General Public 4 * License. See the file "COPYING" in the main directory of this archive 5 * for more details. 6 * 7 * Copyright (C) 1992 - 1997, 2000-2002 Silicon Graphics, Inc. All rights reserved. 8 */ 9#ifndef _ASM_IA64_SN_NIC_H 10#define _ASM_IA64_SN_NIC_H 11 12#include <asm/types.h> 13#include <asm/sn/types.h> 14#include <linux/devfs_fs_kernel.h> 15 16#define MCR_DATA(x) ((int) ((x) & 1)) 17#define MCR_DONE(x) ((x) & 2) 18#define MCR_PACK(pulse, sample) ((pulse) << 10 | (sample) << 2) 19 20typedef __psunsigned_t nic_data_t; 21 22typedef int 23nic_access_f(nic_data_t data, 24 int pulse, int sample, int delay); 25 26typedef nic_access_f *nic_access_t; 27 28typedef struct nic_vmce_s *nic_vmce_t; 29typedef void nic_vmc_func(devfs_handle_t v); 30 31/* 32 * PRIVATE data for Dallas NIC 33 */ 34 35typedef struct nic_state_t { 36 nic_access_t access; 37 nic_data_t data; 38 int last_disc; 39 int done; 40 int bit_index; 41 int disc_marker; 42 uchar_t bits[64]; 43} nic_state_t; 44 45/* 46 * Public interface for Dallas NIC 47 * 48 * 49 * Access Routine 50 * 51 * nic_setup requires an access routine that pulses the NIC line for a 52 * specified duration, samples the NIC line after a specified duration, 53 * then delays for a third specified duration (for precharge). 54 * 55 * This general scheme allows us to access NICs through any medium 56 * (e.g. hub regs, bridge regs, vector writes, system ctlr commands). 57 * 58 * The access routine should return the sample value 0 or 1, or if an 59 * error occurs, return a negative error code. Negative error codes from 60 * the access routine will abort the NIC operation and be propagated 61 * through out of the top-level NIC call. 62 */ 63 64#define NIC_OK 0 65#define NIC_DONE 1 66#define NIC_FAIL 2 67#define NIC_BAD_CRC 3 68#define NIC_NOT_PRESENT 4 69#define NIC_REDIR_LOOP 5 70#define NIC_PARAM 6 71#define NIC_NOMEM 7 72 73uint64_t nic_get_phase_bits(void); 74 75extern int nic_setup(nic_state_t *ns, 76 nic_access_t access, 77 nic_data_t data); 78 79extern int nic_next(nic_state_t *ns, 80 char *serial, 81 char *family, 82 char *crc); 83 84extern int nic_read_one_page(nic_state_t *ns, 85 char *family, 86 char *serial, 87 char *crc, 88 int start, 89 uchar_t *redirect, 90 uchar_t *byte); 91 92extern int nic_read_mfg(nic_state_t *ns, 93 char *family, 94 char *serial, 95 char *crc, 96 uchar_t *pageA, 97 uchar_t *pageB); 98 99extern int nic_info_get(nic_access_t access, 100 nic_data_t data, 101 char *info); 102 103extern int nic_item_info_get(char *buf, char *item, char **item_info); 104 105nic_access_f nic_access_mcr32; 106 107extern char *nic_vertex_info_get(devfs_handle_t v); 108 109extern char *nic_vertex_info_set(nic_access_t access, 110 nic_data_t data, 111 devfs_handle_t v); 112 113extern int nic_vertex_info_match(devfs_handle_t vertex, 114 char *name); 115 116extern char *nic_bridge_vertex_info(devfs_handle_t vertex, 117 nic_data_t data); 118extern char *nic_hq4_vertex_info(devfs_handle_t vertex, 119 nic_data_t data); 120extern char *nic_ioc3_vertex_info(devfs_handle_t vertex, 121 nic_data_t data, 122 int32_t *gpcr_s); 123 124extern char *nic_hub_vertex_info(devfs_handle_t vertex); 125 126extern nic_vmce_t nic_vmc_add(char *, nic_vmc_func *); 127extern void nic_vmc_del(nic_vmce_t); 128 129#endif /* _ASM_IA64_SN_NIC_H */ 130