excavar.h (108064) | excavar.h (110841) |
---|---|
1/* $FreeBSD: head/sys/dev/exca/excavar.h 108064 2002-12-18 22:53:24Z semenu $ */ | 1/* $FreeBSD: head/sys/dev/exca/excavar.h 110841 2003-02-14 06:21:18Z imp $ */ |
2 3/* 4 * Copyright (c) 2002 M Warner Losh. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright --- 46 unchanged lines hidden (view full) --- 56 57#ifndef _SYS_DEV_EXCA_EXCAVAR_H 58#define _SYS_DEV_EXCA_EXCAVAR_H 59 60/* 61 * Structure to manage the ExCA part of the chip. 62 */ 63struct exca_softc; | 2 3/* 4 * Copyright (c) 2002 M Warner Losh. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright --- 46 unchanged lines hidden (view full) --- 56 57#ifndef _SYS_DEV_EXCA_EXCAVAR_H 58#define _SYS_DEV_EXCA_EXCAVAR_H 59 60/* 61 * Structure to manage the ExCA part of the chip. 62 */ 63struct exca_softc; |
64typedef uint8_t (exca_getb_fn)(struct exca_softc *, int); 65typedef void (exca_putb_fn)(struct exca_softc *, int, uint8_t); |
|
64 65struct exca_softc 66{ 67 device_t dev; 68 int memalloc; 69 struct pccard_mem_handle mem[EXCA_MEM_WINS]; 70 int ioalloc; 71 struct pccard_io_handle io[EXCA_IO_WINS]; 72 bus_space_tag_t bst; 73 bus_space_handle_t bsh; 74 uint32_t flags; 75#define EXCA_SOCKET_PRESENT 0x00000001 76#define EXCA_HAS_MEMREG_WIN 0x00000002 77 uint32_t offset; | 66 67struct exca_softc 68{ 69 device_t dev; 70 int memalloc; 71 struct pccard_mem_handle mem[EXCA_MEM_WINS]; 72 int ioalloc; 73 struct pccard_io_handle io[EXCA_IO_WINS]; 74 bus_space_tag_t bst; 75 bus_space_handle_t bsh; 76 uint32_t flags; 77#define EXCA_SOCKET_PRESENT 0x00000001 78#define EXCA_HAS_MEMREG_WIN 0x00000002 79 uint32_t offset; |
80 int chipset; 81#define EXCA_CARDBUS 0 82#define EXCA_I82365 1 /* Intel i82365SL-A/B or clone */ 83#define EXCA_I82365SL_DF 2 /* Intel i82365sl-DF step */ 84#define EXCA_VLSI 3 /* VLSI chip */ 85#define EXCA_PD6710 4 /* Cirrus logic PD6710 */ 86#define EXCA_PD6722 5 /* Cirrus logic PD6722 */ 87#define EXCA_PD6729 6 /* Cirrus Logic PD6729 */ 88#define EXCA_VG365 7 /* Vadem 365 */ 89#define EXCA_VG465 8 /* Vadem 465 */ 90#define EXCA_VG468 9 /* Vadem 468 */ 91#define EXCA_VG469 10 /* Vadem 469 */ 92#define EXCA_RF5C296 11 /* Ricoh RF5C296 */ 93#define EXCA_RF5C396 12 /* Ricoh RF5C396 */ 94#define EXCA_IBM 13 /* IBM clone */ 95#define EXCA_IBM_KING 14 /* IBM KING PCMCIA Controller */ 96 exca_getb_fn *getb; 97 exca_putb_fn *putb; |
|
78}; 79 80void exca_init(struct exca_softc *sc, device_t dev, 81 bus_space_tag_t, bus_space_handle_t, uint32_t); 82int exca_io_map(struct exca_softc *sc, int width, struct resource *r); 83int exca_io_unmap_res(struct exca_softc *sc, struct resource *res); 84int exca_is_pcic(struct exca_softc *sc); 85int exca_mem_map(struct exca_softc *sc, int kind, struct resource *res); 86int exca_mem_set_flags(struct exca_softc *sc, struct resource *res, 87 uint32_t flags); 88int exca_mem_set_offset(struct exca_softc *sc, struct resource *res, 89 uint32_t cardaddr, uint32_t *deltap); 90int exca_mem_unmap_res(struct exca_softc *sc, struct resource *res); | 98}; 99 100void exca_init(struct exca_softc *sc, device_t dev, 101 bus_space_tag_t, bus_space_handle_t, uint32_t); 102int exca_io_map(struct exca_softc *sc, int width, struct resource *r); 103int exca_io_unmap_res(struct exca_softc *sc, struct resource *res); 104int exca_is_pcic(struct exca_softc *sc); 105int exca_mem_map(struct exca_softc *sc, int kind, struct resource *res); 106int exca_mem_set_flags(struct exca_softc *sc, struct resource *res, 107 uint32_t flags); 108int exca_mem_set_offset(struct exca_softc *sc, struct resource *res, 109 uint32_t cardaddr, uint32_t *deltap); 110int exca_mem_unmap_res(struct exca_softc *sc, struct resource *res); |
91int exca_probe_slots(device_t dev, struct exca_softc *); | 111int exca_probe_slots(device_t dev, struct exca_softc *exca, 112 bus_space_tag_t iot, bus_space_handle_t ioh); |
92void exca_reset(struct exca_softc *, device_t child); 93 94static __inline uint8_t | 113void exca_reset(struct exca_softc *, device_t child); 114 115static __inline uint8_t |
95exca_read(struct exca_softc *sc, int reg) | 116exca_getb(struct exca_softc *sc, int reg) |
96{ | 117{ |
97 return (bus_space_read_1(sc->bst, sc->bsh, sc->offset + reg)); | 118 return (sc->getb(sc, reg)); |
98} 99 100static __inline void | 119} 120 121static __inline void |
101exca_write(struct exca_softc *sc, int reg, uint8_t val) | 122exca_putb(struct exca_softc *sc, int reg, uint8_t val) |
102{ | 123{ |
103 bus_space_write_1(sc->bst, sc->bsh, sc->offset + reg, val); | 124 sc->putb(sc, reg, val); |
104} 105 106static __inline void 107exca_setb(struct exca_softc *sc, int reg, uint8_t mask) 108{ | 125} 126 127static __inline void 128exca_setb(struct exca_softc *sc, int reg, uint8_t mask) 129{ |
109 exca_write(sc, reg, exca_read(sc, reg) | mask); | 130 exca_putb(sc, reg, exca_getb(sc, reg) | mask); |
110} 111 112static __inline void 113exca_clrb(struct exca_softc *sc, int reg, uint8_t mask) 114{ | 131} 132 133static __inline void 134exca_clrb(struct exca_softc *sc, int reg, uint8_t mask) 135{ |
115 exca_write(sc, reg, exca_read(sc, reg) & ~mask); | 136 exca_putb(sc, reg, exca_getb(sc, reg) & ~mask); |
116} 117 118#endif /* !_SYS_DEV_EXCA_EXCAVAR_H */ | 137} 138 139#endif /* !_SYS_DEV_EXCA_EXCAVAR_H */ |