FreeBSD/sys/dev/pci/pci.c
/* Perform early OHCI takeover from SMM. */
Perform early OHCI takeover from SMM.
Perform early OHCI takeover from SMM .
static void
ohci_early_takeover(device_t self)
{
	struct resource *res;
	uint32_t ctl;
	int rid;
	int i;
	rid = PCIR_BAR(0);
	res = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid, RF_ACTIVE);
	if (res == NULL)
		return;
	ctl = bus_read_4(res, OHCI_CONTROL);
	if (ctl & OHCI_IR) {
		if (bootverbose)
			printf("ohci early: "
			    "SMM active, request owner change\n");
		bus_write_4(res, OHCI_COMMAND_STATUS, OHCI_OCR);
		for (i = 0; (i < 100) && (ctl & OHCI_IR); i++) {
			DELAY(1000);
			ctl = bus_read_4(res, OHCI_CONTROL);
		}
		if (ctl & OHCI_IR) {
			if (bootverbose)
				printf("ohci early: "
				    "SMM does not respond, resetting\n");
			bus_write_4(res, OHCI_CONTROL, OHCI_HCFS_RESET);
		}
		bus_write_4(res, OHCI_INTERRUPT_DISABLE, OHCI_ALL_INTRS);
	}
	bus_release_resource(self, SYS_RES_MEMORY, rid, res);
}
static void ohci_early_takeover ( device_t self ) { struct resource * res ; uint32_t ctl ; int rid ; int i ; rid = PCIR_BAR ( 0 ) ; res = bus_alloc_resource_any ( self , SYS_RES_MEMORY , & rid , RF_ACTIVE ) ; if ( res == NULL ) return ; ctl = bus_read_4 ( res , OHCI_CONTROL ) ; if ( ctl & OHCI_IR ) { if ( bootverbose ) printf ( " " " \n " ) ; bus_write_4 ( res , OHCI_COMMAND_STATUS , OHCI_OCR ) ; for ( i = 0 ; ( i < 100 ) && ( ctl & OHCI_IR ) ; i ++ ) { DELAY ( 1000 ) ; ctl = bus_read_4 ( res , OHCI_CONTROL ) ; } if ( ctl & OHCI_IR ) { if ( bootverbose ) printf ( " " " \n " ) ; bus_write_4 ( res , OHCI_CONTROL , OHCI_HCFS_RESET ) ; } bus_write_4 ( res , OHCI_INTERRUPT_DISABLE , OHCI_ALL_INTRS ) ; } bus_release_resource ( self , SYS_RES_MEMORY , rid , res ) ; }
Perform early OHCI takeover from SMM.
Perform early OHCI takeover from SMM .
/* Disable interrupts */