Deleted Added
full compact
cardbus_cis.c (107301) cardbus_cis.c (109623)
1/*
2 * Copyright (c) 2000,2001 Jonathan Chen.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
1/*
2 * Copyright (c) 2000,2001 Jonathan Chen.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * $FreeBSD: head/sys/dev/cardbus/cardbus_cis.c 107301 2002-11-27 06:56:29Z imp $
28 * $FreeBSD: head/sys/dev/cardbus/cardbus_cis.c 109623 2003-01-21 08:56:16Z alfred $
29 */
30
31/*
32 * CIS Handling for the Cardbus Bus
33 */
34
35#include <sys/param.h>
36#include <sys/systm.h>

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

163 return (0);
164}
165
166DECODE_PROTOTYPE(copy)
167{
168 struct cis_tupleinfo *tmpbuf;
169
170 tmpbuf = malloc(sizeof(struct cis_tupleinfo) * (ncisread_buf+1),
29 */
30
31/*
32 * CIS Handling for the Cardbus Bus
33 */
34
35#include <sys/param.h>
36#include <sys/systm.h>

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

163 return (0);
164}
165
166DECODE_PROTOTYPE(copy)
167{
168 struct cis_tupleinfo *tmpbuf;
169
170 tmpbuf = malloc(sizeof(struct cis_tupleinfo) * (ncisread_buf+1),
171 M_DEVBUF, M_WAITOK);
171 M_DEVBUF, 0);
172 if (ncisread_buf > 0) {
173 memcpy(tmpbuf, cisread_buf,
174 sizeof(struct cis_tupleinfo) * ncisread_buf);
175 free(cisread_buf, M_DEVBUF);
176 }
177 cisread_buf = tmpbuf;
178
179 cisread_buf[ncisread_buf].id = id;
180 cisread_buf[ncisread_buf].len = len;
172 if (ncisread_buf > 0) {
173 memcpy(tmpbuf, cisread_buf,
174 sizeof(struct cis_tupleinfo) * ncisread_buf);
175 free(cisread_buf, M_DEVBUF);
176 }
177 cisread_buf = tmpbuf;
178
179 cisread_buf[ncisread_buf].id = id;
180 cisread_buf[ncisread_buf].len = len;
181 cisread_buf[ncisread_buf].data = malloc(len, M_DEVBUF, M_WAITOK);
181 cisread_buf[ncisread_buf].data = malloc(len, M_DEVBUF, 0);
182 memcpy(cisread_buf[ncisread_buf].data, tupledata, len);
183 ncisread_buf++;
184 return (0);
185}
186
187DECODE_PROTOTYPE(linktarget)
188{
189#ifdef CARDBUS_DEBUG

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

700
701 count = 0;
702 SLIST_FOREACH(rle, &dinfo->pci.resources, link) {
703 count++;
704 }
705 if (count == 0)
706 return (0);
707 barlist = malloc(sizeof(struct resource_list_entry*) * count, M_DEVBUF,
182 memcpy(cisread_buf[ncisread_buf].data, tupledata, len);
183 ncisread_buf++;
184 return (0);
185}
186
187DECODE_PROTOTYPE(linktarget)
188{
189#ifdef CARDBUS_DEBUG

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

700
701 count = 0;
702 SLIST_FOREACH(rle, &dinfo->pci.resources, link) {
703 count++;
704 }
705 if (count == 0)
706 return (0);
707 barlist = malloc(sizeof(struct resource_list_entry*) * count, M_DEVBUF,
708 M_WAITOK);
708 0);
709 count = 0;
710 SLIST_FOREACH(rle, &dinfo->pci.resources, link) {
711 barlist[count] = rle;
712 if (rle->type == SYS_RES_IOPORT) {
713 io_size += rle->count;
714 } else if (rle->type == SYS_RES_MEMORY) {
715 if (dinfo->mprefetchable & BARBIT(rle->rid))
716 mem_psize += rle->count;

--- 396 unchanged lines hidden ---
709 count = 0;
710 SLIST_FOREACH(rle, &dinfo->pci.resources, link) {
711 barlist[count] = rle;
712 if (rle->type == SYS_RES_IOPORT) {
713 io_size += rle->count;
714 } else if (rle->type == SYS_RES_MEMORY) {
715 if (dinfo->mprefetchable & BARBIT(rle->rid))
716 mem_psize += rle->count;

--- 396 unchanged lines hidden ---