pccardvar.h (76387) | pccardvar.h (82378) |
---|---|
1/* $NetBSD: pcmciavar.h,v 1.12 2000/02/08 12:51:31 enami Exp $ */ | 1/* $NetBSD: pcmciavar.h,v 1.12 2000/02/08 12:51:31 enami Exp $ */ |
2/* $FreeBSD: head/sys/dev/pccard/pccardvar.h 76387 2001-05-08 23:56:47Z dmlb $ */ | 2/* $FreeBSD: head/sys/dev/pccard/pccardvar.h 82378 2001-08-27 00:09:42Z jon $ */ |
3 4/* 5 * Copyright (c) 1997 Marc Horowitz. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright --- 169 unchanged lines hidden (view full) --- 180 181struct pccard_softc { 182 device_t dev; 183 /* this stuff is for the socket */ 184 185 /* this stuff is for the card */ 186 struct pccard_card card; 187 int sc_enabled_count; /* num functions enabled */ | 3 4/* 5 * Copyright (c) 1997 Marc Horowitz. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright --- 169 unchanged lines hidden (view full) --- 180 181struct pccard_softc { 182 device_t dev; 183 /* this stuff is for the socket */ 184 185 /* this stuff is for the card */ 186 struct pccard_card card; 187 int sc_enabled_count; /* num functions enabled */ |
188 int intr_handler_count; | |
189}; 190 191void 192pccardbus_if_setup(struct pccard_softc*); 193 194struct pccard_cis_quirk { 195 int32_t manufacturer; 196 int32_t product; --- 36 unchanged lines hidden (view full) --- 233 234#define pccard_cis_read_1(tuple, idx0) \ 235 (bus_space_read_1((tuple)->memt, (tuple)->memh, (tuple)->mult*(idx0))) 236 237#define pccard_tuple_read_1(tuple, idx1) \ 238 (pccard_cis_read_1((tuple), ((tuple)->ptr+(2+(idx1))))) 239 240#define pccard_tuple_read_2(tuple, idx2) \ | 188}; 189 190void 191pccardbus_if_setup(struct pccard_softc*); 192 193struct pccard_cis_quirk { 194 int32_t manufacturer; 195 int32_t product; --- 36 unchanged lines hidden (view full) --- 232 233#define pccard_cis_read_1(tuple, idx0) \ 234 (bus_space_read_1((tuple)->memt, (tuple)->memh, (tuple)->mult*(idx0))) 235 236#define pccard_tuple_read_1(tuple, idx1) \ 237 (pccard_cis_read_1((tuple), ((tuple)->ptr+(2+(idx1))))) 238 239#define pccard_tuple_read_2(tuple, idx2) \ |
241 (pccard_tuple_read_1((tuple), (idx2)) | \ | 240 (pccard_tuple_read_1((tuple), (idx2)) | \ |
242 (pccard_tuple_read_1((tuple), (idx2)+1)<<8)) 243 244#define pccard_tuple_read_3(tuple, idx3) \ 245 (pccard_tuple_read_1((tuple), (idx3)) | \ 246 (pccard_tuple_read_1((tuple), (idx3)+1)<<8) | \ 247 (pccard_tuple_read_1((tuple), (idx3)+2)<<16)) 248 249#define pccard_tuple_read_4(tuple, idx4) \ --- 6 unchanged lines hidden (view full) --- 256 (((n)==1)?pccard_tuple_read_1((tuple), (idxn)) : \ 257 (((n)==2)?pccard_tuple_read_2((tuple), (idxn)) : \ 258 (((n)==3)?pccard_tuple_read_3((tuple), (idxn)) : \ 259 /* n == 4 */ pccard_tuple_read_4((tuple), (idxn))))) 260 261#define PCCARD_SPACE_MEMORY 1 262#define PCCARD_SPACE_IO 2 263 | 241 (pccard_tuple_read_1((tuple), (idx2)+1)<<8)) 242 243#define pccard_tuple_read_3(tuple, idx3) \ 244 (pccard_tuple_read_1((tuple), (idx3)) | \ 245 (pccard_tuple_read_1((tuple), (idx3)+1)<<8) | \ 246 (pccard_tuple_read_1((tuple), (idx3)+2)<<16)) 247 248#define pccard_tuple_read_4(tuple, idx4) \ --- 6 unchanged lines hidden (view full) --- 255 (((n)==1)?pccard_tuple_read_1((tuple), (idxn)) : \ 256 (((n)==2)?pccard_tuple_read_2((tuple), (idxn)) : \ 257 (((n)==3)?pccard_tuple_read_3((tuple), (idxn)) : \ 258 /* n == 4 */ pccard_tuple_read_4((tuple), (idxn))))) 259 260#define PCCARD_SPACE_MEMORY 1 261#define PCCARD_SPACE_IO 2 262 |
264int pccard_ccr_read(struct pccard_function *, int); 265void pccard_ccr_write(struct pccard_function *, int, int); 266 | |
267#define pccard_mfc(sc) (STAILQ_FIRST(&(sc)->card.pf_head) && \ 268 STAILQ_NEXT(STAILQ_FIRST(&(sc)->card.pf_head),pf_list)) 269 | 263#define pccard_mfc(sc) (STAILQ_FIRST(&(sc)->card.pf_head) && \ 264 STAILQ_NEXT(STAILQ_FIRST(&(sc)->card.pf_head),pf_list)) 265 |
270/* The following is the vestages of the NetBSD driver api */ 271 272void pccard_function_init(struct pccard_function *); 273int pccard_function_enable(struct pccard_function *); 274void pccard_function_disable(struct pccard_function *); 275 | |
276#define pccard_io_alloc(pf, start, size, align, pciop) \ 277 (pccard_chip_io_alloc((pf)->sc->pct, pf->sc->pch, (start), \ 278 (size), (align), (pciop))) 279 280#define pccard_io_free(pf, pciohp) \ 281 (pccard_chip_io_free((pf)->sc->pct, (pf)->sc->pch, (pciohp))) 282 283int pccard_io_map(struct pccard_function *, int, bus_addr_t, --- 35 unchanged lines hidden (view full) --- 319 PCCARD_IVAR_CIS4_STR, 320 PCCARD_IVAR_FUNCTION 321}; 322 323#define PCCARD_ACCESSOR(A, B, T) \ 324__inline static int \ 325pccard_get_ ## A(device_t dev, T *t) \ 326{ \ | 266#define pccard_io_alloc(pf, start, size, align, pciop) \ 267 (pccard_chip_io_alloc((pf)->sc->pct, pf->sc->pch, (start), \ 268 (size), (align), (pciop))) 269 270#define pccard_io_free(pf, pciohp) \ 271 (pccard_chip_io_free((pf)->sc->pct, (pf)->sc->pch, (pciohp))) 272 273int pccard_io_map(struct pccard_function *, int, bus_addr_t, --- 35 unchanged lines hidden (view full) --- 309 PCCARD_IVAR_CIS4_STR, 310 PCCARD_IVAR_FUNCTION 311}; 312 313#define PCCARD_ACCESSOR(A, B, T) \ 314__inline static int \ 315pccard_get_ ## A(device_t dev, T *t) \ 316{ \ |
327 return BUS_READ_IVAR(device_get_parent(dev), dev, \ | 317 return BUS_READ_IVAR(device_get_parent(dev), dev, \ |
328 PCCARD_IVAR_ ## B, (uintptr_t *) t); \ 329} 330 331PCCARD_ACCESSOR(ether, ETHADDR, u_int8_t) 332PCCARD_ACCESSOR(vendor, VENDOR, u_int32_t) 333PCCARD_ACCESSOR(product, PRODUCT, u_int32_t) 334PCCARD_ACCESSOR(function_number,FUNCTION_NUMBER, u_int32_t) 335PCCARD_ACCESSOR(function, FUNCTION, u_int32_t) --- 14 unchanged lines hidden --- | 318 PCCARD_IVAR_ ## B, (uintptr_t *) t); \ 319} 320 321PCCARD_ACCESSOR(ether, ETHADDR, u_int8_t) 322PCCARD_ACCESSOR(vendor, VENDOR, u_int32_t) 323PCCARD_ACCESSOR(product, PRODUCT, u_int32_t) 324PCCARD_ACCESSOR(function_number,FUNCTION_NUMBER, u_int32_t) 325PCCARD_ACCESSOR(function, FUNCTION, u_int32_t) --- 14 unchanged lines hidden --- |