cardbus.c (cc557faf869a59b97f775284749648b57948cef2) | cardbus.c (c6df6f5322f7004c71216391e1c0b374d853704a) |
---|---|
1/*- 2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3 * 4 * Copyright (c) 2000,2001 Jonathan Chen. All rights reserved. 5 * Copyright (c) 2003-2008 M. Warner Losh <imp@FreeBSD.org> 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 185 unchanged lines hidden (view full) --- 194 195 sc = device_get_softc(cbdev); 196 cardbus_detach_card(cbdev); /* detach existing cards */ 197 POWER_DISABLE_SOCKET(brdev, cbdev); /* Turn the socket off first */ 198 POWER_ENABLE_SOCKET(brdev, cbdev); 199 domain = pcib_get_domain(cbdev); 200 bus = pcib_get_bus(cbdev); 201 slot = 0; | 1/*- 2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3 * 4 * Copyright (c) 2000,2001 Jonathan Chen. All rights reserved. 5 * Copyright (c) 2003-2008 M. Warner Losh <imp@FreeBSD.org> 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 185 unchanged lines hidden (view full) --- 194 195 sc = device_get_softc(cbdev); 196 cardbus_detach_card(cbdev); /* detach existing cards */ 197 POWER_DISABLE_SOCKET(brdev, cbdev); /* Turn the socket off first */ 198 POWER_ENABLE_SOCKET(brdev, cbdev); 199 domain = pcib_get_domain(cbdev); 200 bus = pcib_get_bus(cbdev); 201 slot = 0; |
202 mtx_lock(&Giant); | 202 bus_topo_lock(); |
203 /* For each function, set it up and try to attach a driver to it */ 204 for (func = 0; func <= cardbusfunchigh; func++) { 205 struct cardbus_devinfo *dinfo; 206 207 dinfo = (struct cardbus_devinfo *) 208 pci_read_device(brdev, cbdev, domain, bus, slot, func); 209 if (dinfo == NULL) 210 continue; --- 17 unchanged lines hidden (view full) --- 228 cardbus_device_setup_regs(&dinfo->pci.cfg); 229 pci_add_resources(cbdev, child, 1, dinfo->mprefetchable); 230 pci_print_verbose(&dinfo->pci); 231 if (device_probe_and_attach(child) == 0) 232 cardattached++; 233 else 234 pci_cfg_save(dinfo->pci.cfg.dev, &dinfo->pci, 1); 235 } | 203 /* For each function, set it up and try to attach a driver to it */ 204 for (func = 0; func <= cardbusfunchigh; func++) { 205 struct cardbus_devinfo *dinfo; 206 207 dinfo = (struct cardbus_devinfo *) 208 pci_read_device(brdev, cbdev, domain, bus, slot, func); 209 if (dinfo == NULL) 210 continue; --- 17 unchanged lines hidden (view full) --- 228 cardbus_device_setup_regs(&dinfo->pci.cfg); 229 pci_add_resources(cbdev, child, 1, dinfo->mprefetchable); 230 pci_print_verbose(&dinfo->pci); 231 if (device_probe_and_attach(child) == 0) 232 cardattached++; 233 else 234 pci_cfg_save(dinfo->pci.cfg.dev, &dinfo->pci, 1); 235 } |
236 mtx_unlock(&Giant); | 236 bus_topo_unlock(); |
237 if (cardattached > 0) 238 return (0); 239/* POWER_DISABLE_SOCKET(brdev, cbdev); */ 240 return (ENOENT); 241} 242 243static void 244cardbus_child_deleted(device_t cbdev, device_t child) --- 6 unchanged lines hidden (view full) --- 251 pci_child_deleted(cbdev, child); 252} 253 254static int 255cardbus_detach_card(device_t cbdev) 256{ 257 int err = 0; 258 | 237 if (cardattached > 0) 238 return (0); 239/* POWER_DISABLE_SOCKET(brdev, cbdev); */ 240 return (ENOENT); 241} 242 243static void 244cardbus_child_deleted(device_t cbdev, device_t child) --- 6 unchanged lines hidden (view full) --- 251 pci_child_deleted(cbdev, child); 252} 253 254static int 255cardbus_detach_card(device_t cbdev) 256{ 257 int err = 0; 258 |
259 mtx_lock(&Giant); | 259 bus_topo_lock(); |
260 err = bus_generic_detach(cbdev); 261 if (err == 0) 262 err = device_delete_children(cbdev); | 260 err = bus_generic_detach(cbdev); 261 if (err == 0) 262 err = device_delete_children(cbdev); |
263 mtx_unlock(&Giant); | 263 bus_topo_unlock(); |
264 if (err) 265 return (err); 266 267 POWER_DISABLE_SOCKET(device_get_parent(cbdev), cbdev); 268 return (err); 269} 270 271static void --- 100 unchanged lines hidden --- | 264 if (err) 265 return (err); 266 267 POWER_DISABLE_SOCKET(device_get_parent(cbdev), cbdev); 268 return (err); 269} 270 271static void --- 100 unchanged lines hidden --- |