Deleted Added
full compact
pccard.c (66200) pccard.c (66779)
1/* $NetBSD: pcmcia.c,v 1.23 2000/07/28 19:17:02 drochner Exp $ */
1/* $NetBSD: pcmcia.c,v 1.23 2000/07/28 19:17:02 drochner Exp $ */
2/* $FreeBSD: head/sys/dev/pccard/pccard.c 66200 2000-09-22 01:15:26Z imp $ */
2/* $FreeBSD: head/sys/dev/pccard/pccard.c 66779 2000-10-07 05:48:51Z 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

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

155 * routines will do the right thing. This many mean a
156 * departure from the current NetBSD model.
157 *
158 * This could get really ugly for multifunction cards. But
159 * it might also just fall out of the FreeBSD resource model.
160 *
161 */
162 device_printf(dev, "Starting to attach....\n");
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

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

155 * routines will do the right thing. This many mean a
156 * departure from the current NetBSD model.
157 *
158 * This could get really ugly for multifunction cards. But
159 * it might also just fall out of the FreeBSD resource model.
160 *
161 */
162 device_printf(dev, "Starting to attach....\n");
163 /* XXX Need ivars XXXimpXXX */
164 ivar = malloc(sizeof(struct pccard_ivar), M_DEVBUF, M_WAITOK);
165 child = device_add_child(dev, NULL, -1);
166 device_set_ivars(child, ivar);
167 pccard_function_init(pf);
168 pccard_function_enable(pf);
169 device_printf(dev, "pf %p pf->sc %p\n", pf, pf->sc);
170 if (device_probe_and_attach(child) == 0) {
171 attached++;

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

734{
735 return CARD_SET_MEMORY_OFFSET(device_get_parent(dev), child, rid,
736 offset);
737}
738
739static int
740pccard_read_ivar(device_t bus, device_t child, int which, u_char *result)
741{
163 ivar = malloc(sizeof(struct pccard_ivar), M_DEVBUF, M_WAITOK);
164 child = device_add_child(dev, NULL, -1);
165 device_set_ivars(child, ivar);
166 pccard_function_init(pf);
167 pccard_function_enable(pf);
168 device_printf(dev, "pf %p pf->sc %p\n", pf, pf->sc);
169 if (device_probe_and_attach(child) == 0) {
170 attached++;

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

733{
734 return CARD_SET_MEMORY_OFFSET(device_get_parent(dev), child, rid,
735 offset);
736}
737
738static int
739pccard_read_ivar(device_t bus, device_t child, int which, u_char *result)
740{
741 struct pccard_ivar *devi = (struct pccard_ivar *) device_get_ivars(child);
742 struct pccard_function *func = devi->fcn;
743 struct pccard_softc *sc = PCCARD_SOFTC(bus);
744
742 /* PCCARD_IVAR_ETHADDR unhandled from oldcard */
745 /* PCCARD_IVAR_ETHADDR unhandled from oldcard */
743 return ENOENT;
746 switch (which) {
747 default:
748 case PCCARD_IVAR_ETHADDR:
749 return (ENOENT);
750 break;
751 case PCCARD_IVAR_VENDOR:
752 *(u_int32_t *) result = sc->card.manufacturer;
753 break;
754 case PCCARD_IVAR_PRODUCT:
755 *(u_int32_t *) result = sc->card.product;
756 break;
757 case PCCARD_IVAR_FUNCTION_NUMBER:
758 /* XXX imp XXX */
759 /* *(u_int32_t *) result = func->number; */
760 *(u_int32_t *) result = 0;
761 break;
762 case PCCARD_IVAR_VENDOR_STR:
763 *(char **) result = sc->card.cis1_info[0];
764 break;
765 case PCCARD_IVAR_PRODUCT_STR:
766 *(char **) result = sc->card.cis1_info[1];
767 break;
768 case PCCARD_IVAR_CIS3_STR:
769 *(char **) result = sc->card.cis1_info[2];
770 break;
771 }
772 return (0);
744}
745
773}
774
775static void
776pccard_driver_added(device_t dev, driver_t *driver)
777{
778 /* XXX eventually we need to attach stuff when we know we */
779 /* XXX have kids. */
780}
746
747static device_method_t pccard_methods[] = {
748 /* Device interface */
749 DEVMETHOD(device_probe, pccard_probe),
750 DEVMETHOD(device_attach, pccard_attach),
751 DEVMETHOD(device_detach, bus_generic_detach),
752 DEVMETHOD(device_shutdown, bus_generic_shutdown),
753 DEVMETHOD(device_suspend, bus_generic_suspend),
754 DEVMETHOD(device_resume, bus_generic_resume),
755
756 /* Bus interface */
757 DEVMETHOD(bus_print_child, pccard_print_child),
781
782static device_method_t pccard_methods[] = {
783 /* Device interface */
784 DEVMETHOD(device_probe, pccard_probe),
785 DEVMETHOD(device_attach, pccard_attach),
786 DEVMETHOD(device_detach, bus_generic_detach),
787 DEVMETHOD(device_shutdown, bus_generic_shutdown),
788 DEVMETHOD(device_suspend, bus_generic_suspend),
789 DEVMETHOD(device_resume, bus_generic_resume),
790
791 /* Bus interface */
792 DEVMETHOD(bus_print_child, pccard_print_child),
758 DEVMETHOD(bus_driver_added, bus_generic_driver_added),
793 DEVMETHOD(bus_driver_added, pccard_driver_added),
759 DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
760 DEVMETHOD(bus_release_resource, bus_generic_release_resource),
761 DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
762 DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
763 DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
764 DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
765 DEVMETHOD(bus_set_resource, pccard_set_resource),
766 DEVMETHOD(bus_get_resource, pccard_get_resource),

--- 27 unchanged lines hidden ---
794 DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
795 DEVMETHOD(bus_release_resource, bus_generic_release_resource),
796 DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
797 DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
798 DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
799 DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
800 DEVMETHOD(bus_set_resource, pccard_set_resource),
801 DEVMETHOD(bus_get_resource, pccard_get_resource),

--- 27 unchanged lines hidden ---