Commit graph

22 commits

Author SHA1 Message Date
cinap_lenrek 20ea113790 kernel: support large 64-bit pci membars, increase pc64 VMAPSIZE to 1TB
This makes vmap()/vunmap() take a vlong size argument,
and change the type of Pci.mem[].size to vlong as well.

Even if vmap() wont support large mappings, it is nice to
get the original unruncated value for error checking.

pc64 needs a bigger VMAP window, as system76 pangolin
puts the framebuffer at a physical address > 512GB.
2021-11-26 20:51:45 +00:00
cinap_lenrek 3240008dd1 usbuhci: remove resetlk, simplify scanpci() 2021-01-17 11:53:50 +01:00
cinap_lenrek 4f85115526 kernel: massive pci code rewrite
The new pci code is moved to port/pci.[hc] and shared by
all ports.

Each port has its own PCI controller implementation,
providing the pcicfgrw*() functions for low level pci
config space access. The locking for pcicfgrw*() is now
done by the caller (only port/pci.c).

Device drivers now need to include "../port/pci.h" in
addition to "io.h".

The new code now checks bridge windows and membars,
while enumerating the bus, giving the pc driver a chance
to re-assign them. This is needed because some UEFI
implementations fail to assign the bars for some devices,
so we need to do it outselfs. (See pcireservemem()).

While working on this, it was discovered that the pci
code assimed the smallest I/O bar size is 16 (pcibarsize()),
which is wrong. I/O bars can be as small as 4 bytes.
Bit 1 in an I/O bar is also reserved and should be masked off,
making the port mask: port = bar & ~3;
2020-09-13 20:33:17 +02:00
cinap_lenrek dd2d6c9430 usbuhci: make sure pci membar type is i/o 2020-06-06 16:10:04 +02:00
cinap_lenrek 9fec0e7360 pc drivers: use pcienable() to handle device power up and missing initialization 2018-10-07 22:28:21 +02:00
cinap_lenrek d6e0e9c402 kernel: move devether and wifi to port/
the only architecture dependence of devether was enabling interrupts,
which is now done at the end of the driver's reset() function now.

the wifi stack and dummy ethersink also go to port/.

do the IRQ2->IRQ9 hack for pc kernels in intrenabale(), so not
every caller of intrenable() has to be aware of it.
2018-02-11 18:08:03 +01:00
cinap_lenrek f0217d2c3f usbohci, usbuhci, usbehci: use physical address of registers for matching controllers and printing 2017-07-22 16:35:13 +02:00
cinap_lenrek c9d2fecbd0 usbuhci: removing "uhci bug" print spam from interrupt handler
this code was if(0) for a long time due to wrong parentesis,
fixed parentesis cause print spam on some machines making them
unusage (kenji okomoto). removing the check alltogether.
2016-02-16 08:52:33 +01:00
cinap_lenrek 27fb90eb6e vblade, cifs, usbuhci: fix parenthesis 2015-06-13 15:03:56 +02:00
cinap_lenrek 41908149de nusb: resolve endpoint id conflict with different input and output types
ftrvxmtrx repots devices that use the endpoint number for
input and output of different types like:

 nusb/ether:             parsedesc endpoint 5[7]  07 05 81 03 08 00 09	# ep1 in intr
 nusb/ether:             parsedesc endpoint 5[7]  07 05 82 02 00 02 00
 nusb/ether:             parsedesc endpoint 5[7]  07 05 01 02 00 02 00	# ep1 out bulk

the previous change tried to work arround this but had the
concequence that only the lastly defined endpoint was
usable.

this change addresses the issue by allowing up to 32 endpoints
per device (16 output + 16 input endpoints) in devusb. the
hci driver will ignore the 4th bit and will only use the
lower 4 bits as endpoint address when talking to the usb
device.

when we encounter a conflict, we map the input endpoint
to the upper id range 16..31 and the output endpoint
to id 0..15 so two distinct endpoints are created.
2014-04-23 20:03:01 +02:00
cinap_lenrek 06bc19c28f kernel: usb fixes for amd64 2014-02-01 10:20:43 +01:00
cinap_lenrek 808480f76b usbehci, usbuhci: paranoia
double the td abort delay and make sure the tsleep() isnt
shortened by a pending note. in that case, tsleep() would
raise error(Eintr); immidiately and would not sleep the
requested amount potentially cauing us to release active
dma memory too early! so we wrap the tsleep() call in a
while(waserror()) so we will at least wait the Abortdelay
amount if error is raised.

also, only try to idle the still active td's.

do not copy data in epio() when there was an error, theres
no reason to touch user buffer in that case.

for uhci, we also check that theres not more data in the
buffers than requested to avoid overflowing user buffer
in epio(). this should not happen but we'r paranoid.

for ehci, we also halt the queue head first in aborttds().
mark the queue heads as Qfree after unlinking and remove
some silly nil checks that are impossible.
2013-08-25 22:03:02 +02:00
cinap_lenrek 5a138029db move devusb to port
moved devusb to port, shifting the responsibility of how
to enable interrupts to the arch specific hci driver.
2012-12-06 18:53:17 +01:00
cinap_lenrek 1d62e1d8c8 usb: dont give up on unassigned pci irq line in hci driver
sometimes, the bios does not assign a interrupt line for pci
devices. this should not be fatal in case of mp ineterrupts
as long as there is intpin or msi can be used.

warn in intrenable() if we hit such a interrupt and set
irq to -1 to prevent it from getting enabled on the pic
or as isa interrupt in apic mode.
2012-09-15 03:17:17 +02:00
cinap_lenrek 0c52215ae3 usb: fix potential isoread overruns, error instead of panic on isoread in ohci 2012-09-03 04:23:02 +02:00
cinap_lenrek cfd25faa28 usb: fix isowrite putsamples race 2012-09-03 01:54:34 +02:00
cinap_lenrek bf3476d661 kernel: fix inproper use of malloc/smalloc 2011-12-12 16:55:26 +01:00
cinap_lenrek 79a044e38e usb: fix potential uninterruptable calls 2011-08-19 05:19:10 +02:00
cinap_lenrek 676a876df6 usb: added buffer delay control 2011-08-01 19:02:50 +02:00
cinap_lenrek 742fe500b5 fix panic in usbuhci driver, increase max number of endpoints and alt configurations, make usb/audio continue besides some errors 2011-05-21 18:39:13 +00:00
Taru Karttunen a9060cc06b Import sources from 2011-03-30 iso image - lib 2011-03-30 19:35:09 +03:00
Taru Karttunen e5888a1ffd Import sources from 2011-03-30 iso image 2011-03-30 15:46:40 +03:00