summaryrefslogtreecommitdiffstats
path: root/sys/dev/cardbus
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2003-02-17 21:20:35 +0000
committerimp <imp@FreeBSD.org>2003-02-17 21:20:35 +0000
commit583fcf1070d55ddcf8c7a9561385a8e8ff0c53e0 (patch)
tree4f68d03a384b1cde118e6478644bb9e14b4ab201 /sys/dev/cardbus
parent80e27851f2afb65a95c749d65636a67daacc2309 (diff)
downloadFreeBSD-src-583fcf1070d55ddcf8c7a9561385a8e8ff0c53e0.zip
FreeBSD-src-583fcf1070d55ddcf8c7a9561385a8e8ff0c53e0.tar.gz
Move the pnp and location info into the common pci bus. Make all known
pci busses implement this. Also minor comment smithing in cardbus. Fix copyright to this year with my name on it since I've been doing a lot to this file. Reviewed by: jhb
Diffstat (limited to 'sys/dev/cardbus')
-rw-r--r--sys/dev/cardbus/cardbus.c50
1 files changed, 4 insertions, 46 deletions
diff --git a/sys/dev/cardbus/cardbus.c b/sys/dev/cardbus/cardbus.c
index 2d265b6..eddfe61 100644
--- a/sys/dev/cardbus/cardbus.c
+++ b/sys/dev/cardbus/cardbus.c
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 2000,2001 Jonathan Chen.
- * All rights reserved.
+ * Copyright (c) 2003 M. Warner Losh. All Rights Reserved.
+ * Copyright (c) 2000,2001 Jonathan Chen. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -28,15 +28,6 @@
* $FreeBSD$
*/
-/*
- * Cardbus Bus Driver
- *
- * much of the bus code was stolen directly from sys/pci/pci.c
- * (Copyright (c) 1997, Stefan Esser <se@freebsd.org>)
- *
- * Written by Jonathan Chen <jon@freebsd.org>
- */
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/malloc.h>
@@ -85,10 +76,6 @@ static struct resource *cardbus_alloc_resource(device_t cbdev, device_t child,
u_int flags);
static int cardbus_attach(device_t cbdev);
static int cardbus_attach_card(device_t cbdev);
-static int cardbus_child_location_str(device_t cbdev, device_t child,
- char *, size_t len);
-static int cardbus_child_pnpinfo_str(device_t cbdev, device_t child,
- char *, size_t len);
static void cardbus_delete_resource(device_t cbdev, device_t child,
int type, int rid);
static void cardbus_delete_resource_method(device_t cbdev, device_t child,
@@ -631,35 +618,6 @@ cardbus_teardown_intr(device_t cbdev, device_t child, struct resource *irq,
/************************************************************************/
static int
-cardbus_child_location_str(device_t cbdev, device_t child, char *buf,
- size_t buflen)
-{
- struct cardbus_devinfo *dinfo;
- pcicfgregs *cfg;
-
- dinfo = device_get_ivars(child);
- cfg = &dinfo->pci.cfg;
- snprintf(buf, buflen, "slot=%d function=%d", pci_get_slot(child),
- pci_get_function(child));
- return (0);
-}
-
-static int
-cardbus_child_pnpinfo_str(device_t cbdev, device_t child, char *buf,
- size_t buflen)
-{
- struct cardbus_devinfo *dinfo;
- pcicfgregs *cfg;
-
- dinfo = device_get_ivars(child);
- cfg = &dinfo->pci.cfg;
- snprintf(buf, buflen, "vendor=0x%04x device=0x%04x subvendor=0x%04x "
- "subdevice=0x%04x", cfg->vendor, cfg->device, cfg->subvendor,
- cfg->subdevice);
- return (0);
-}
-
-static int
cardbus_read_ivar(device_t cbdev, device_t child, int which, uintptr_t *result)
{
struct cardbus_devinfo *dinfo;
@@ -717,8 +675,8 @@ static device_method_t cardbus_methods[] = {
DEVMETHOD(bus_set_resource, cardbus_set_resource_method),
DEVMETHOD(bus_get_resource, cardbus_get_resource_method),
DEVMETHOD(bus_delete_resource, cardbus_delete_resource_method),
- DEVMETHOD(bus_child_pnpinfo_str, cardbus_child_pnpinfo_str),
- DEVMETHOD(bus_child_location_str, cardbus_child_location_str),
+ DEVMETHOD(bus_child_pnpinfo_str, pci_child_pnpinfo_str_method),
+ DEVMETHOD(bus_child_location_str, pci_child_location_str_method),
/* Card Interface */
DEVMETHOD(card_attach_card, cardbus_attach_card),
OpenPOWER on IntegriCloud