Deleted Added
full compact
pccard_cis.c (147711) pccard_cis.c (147729)
1/* $NetBSD: pcmcia_cis.c,v 1.17 2000/02/10 09:01:52 chopps Exp $ */
1/* $NetBSD: pcmcia_cis.c,v 1.17 2000/02/10 09:01:52 chopps Exp $ */
2/* $FreeBSD: head/sys/dev/pccard/pccard_cis.c 147711 2005-07-01 03:40:28Z imp $ */
2/* $FreeBSD: head/sys/dev/pccard/pccard_cis.c 147729 2005-07-01 15:52:50Z imp $ */
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

--- 55 unchanged lines hidden (view full) ---

66 int count;
67 int gotmfc;
68 struct pccard_config_entry temp_cfe;
69 struct pccard_config_entry *default_cfe;
70 struct pccard_card *card;
71 struct pccard_function *pf;
72};
73
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

--- 55 unchanged lines hidden (view full) ---

66 int count;
67 int gotmfc;
68 struct pccard_config_entry temp_cfe;
69 struct pccard_config_entry *default_cfe;
70 struct pccard_card *card;
71 struct pccard_function *pf;
72};
73
74static int pccard_parse_cis_tuple(struct pccard_tuple *, void *);
75static int decode_funce(struct pccard_tuple *, struct pccard_function *);
74static int pccard_parse_cis_tuple(const struct pccard_tuple *, void *);
75static int decode_funce(const struct pccard_tuple *, struct pccard_function *);
76
77void
78pccard_read_cis(struct pccard_softc *sc)
79{
80 struct cis_state state;
81
82 bzero(&state, sizeof state);
76
77void
78pccard_read_cis(struct pccard_softc *sc)
79{
80 struct cis_state state;
81
82 bzero(&state, sizeof state);
83
84 state.card = &sc->card;
83 state.card = &sc->card;
85
86 state.card->error = 0;
87 state.card->cis1_major = -1;
88 state.card->cis1_minor = -1;
89 state.card->cis1_info[0] = NULL;
90 state.card->cis1_info[1] = NULL;
91 state.card->cis1_info[2] = NULL;
92 state.card->cis1_info[3] = NULL;
93 state.card->manufacturer = PCMCIA_VENDOR_INVALID;
94 state.card->product = PCMCIA_PRODUCT_INVALID;
95 STAILQ_INIT(&state.card->pf_head);
84 state.card->error = 0;
85 state.card->cis1_major = -1;
86 state.card->cis1_minor = -1;
87 state.card->cis1_info[0] = NULL;
88 state.card->cis1_info[1] = NULL;
89 state.card->cis1_info[2] = NULL;
90 state.card->cis1_info[3] = NULL;
91 state.card->manufacturer = PCMCIA_VENDOR_INVALID;
92 state.card->product = PCMCIA_PRODUCT_INVALID;
93 STAILQ_INIT(&state.card->pf_head);
96
97 state.pf = NULL;
98
99 tsleep(&state, 0, "pccard", hz);
100 if (pccard_scan_cis(sc->dev, pccard_parse_cis_tuple,
101 &state) == -1)
102 state.card->error++;
103}
104

--- 506 unchanged lines hidden (view full) ---

611 }
612
613 if (card->error)
614 device_printf(dev, "%d errors found while parsing CIS\n",
615 card->error);
616}
617
618static int
94 state.pf = NULL;
95
96 tsleep(&state, 0, "pccard", hz);
97 if (pccard_scan_cis(sc->dev, pccard_parse_cis_tuple,
98 &state) == -1)
99 state.card->error++;
100}
101

--- 506 unchanged lines hidden (view full) ---

608 }
609
610 if (card->error)
611 device_printf(dev, "%d errors found while parsing CIS\n",
612 card->error);
613}
614
615static int
619pccard_parse_cis_tuple(struct pccard_tuple *tuple, void *arg)
616pccard_parse_cis_tuple(const struct pccard_tuple *tuple, void *arg)
620{
621 /* most of these are educated guesses */
622 static struct pccard_config_entry init_cfe = {
623 -1, PCCARD_CFE_RDYBSY_ACTIVE | PCCARD_CFE_WP_ACTIVE |
624 PCCARD_CFE_BVD_ACTIVE, PCCARD_IFTYPE_MEMORY,
625 };
626
627 struct cis_state *state = arg;

--- 180 unchanged lines hidden (view full) ---

808 DPRINTF(("CISTPL_FUNCID\n"));
809 break;
810 case CISTPL_FUNCE:
811 if (state->pf == NULL || state->pf->function <= 0) {
812 DPRINTF(("CISTPL_FUNCE is not followed by "
813 "valid CISTPL_FUNCID\n"));
814 break;
815 }
617{
618 /* most of these are educated guesses */
619 static struct pccard_config_entry init_cfe = {
620 -1, PCCARD_CFE_RDYBSY_ACTIVE | PCCARD_CFE_WP_ACTIVE |
621 PCCARD_CFE_BVD_ACTIVE, PCCARD_IFTYPE_MEMORY,
622 };
623
624 struct cis_state *state = arg;

--- 180 unchanged lines hidden (view full) ---

805 DPRINTF(("CISTPL_FUNCID\n"));
806 break;
807 case CISTPL_FUNCE:
808 if (state->pf == NULL || state->pf->function <= 0) {
809 DPRINTF(("CISTPL_FUNCE is not followed by "
810 "valid CISTPL_FUNCID\n"));
811 break;
812 }
816 if (tuple->length >= 2) {
813 if (tuple->length >= 2)
817 decode_funce(tuple, state->pf);
814 decode_funce(tuple, state->pf);
818 }
819 DPRINTF(("CISTPL_FUNCE\n"));
820 break;
821 case CISTPL_CONFIG:
822 if (tuple->length < 3) {
823 DPRINTF(("CISTPL_CONFIG too short %d\n",
824 tuple->length));
825 break;
826 } {

--- 436 unchanged lines hidden (view full) ---

1263 DPRINTF(("unhandled CISTPL %x\n", tuple->code));
1264 break;
1265 }
1266
1267 return (0);
1268}
1269
1270static int
815 DPRINTF(("CISTPL_FUNCE\n"));
816 break;
817 case CISTPL_CONFIG:
818 if (tuple->length < 3) {
819 DPRINTF(("CISTPL_CONFIG too short %d\n",
820 tuple->length));
821 break;
822 } {

--- 436 unchanged lines hidden (view full) ---

1259 DPRINTF(("unhandled CISTPL %x\n", tuple->code));
1260 break;
1261 }
1262
1263 return (0);
1264}
1265
1266static int
1271decode_funce(struct pccard_tuple *tuple, struct pccard_function *pf)
1267decode_funce(const struct pccard_tuple *tuple, struct pccard_function *pf)
1272{
1273 int i;
1274 int len;
1275 int type = pccard_tuple_read_1(tuple, 0);
1276
1277 switch (pf->function) {
1278 case PCCARD_FUNCTION_DISK:
1279 if (type == PCCARD_TPLFE_TYPE_DISK_DEVICE_INTERFACE) {

--- 34 unchanged lines hidden ---
1268{
1269 int i;
1270 int len;
1271 int type = pccard_tuple_read_1(tuple, 0);
1272
1273 switch (pf->function) {
1274 case PCCARD_FUNCTION_DISK:
1275 if (type == PCCARD_TPLFE_TYPE_DISK_DEVICE_INTERFACE) {

--- 34 unchanged lines hidden ---