ehci Eopio is specified by hardware, and therefore should use u32int and not ulong for structure members. unfortunately we're still stuffing physical addresses in u32ints without checking that they fit. this shouldn't be a problem for any kernel other than the pcpae kernel. Reference: /n/atom/patch/applied2013/9eopio32 Date: Sat Sep 21 21:32:39 CES 2013 Signed-off-by: quanstro@quanstro.net --- /sys/src/9/kw/usbehcikw.c Sat Sep 21 21:30:50 2013 +++ /sys/src/9/kw/usbehcikw.c Sat Sep 21 21:30:51 2013 @@ -173,7 +173,7 @@ ctlr->nframes = 256; break; default: - panic("ehci: unknown fls %ld", opio->cmd & Cflsmask); + panic("ehci: unknown fls %d", opio->cmd & Cflsmask); } dprint("ehci: %d frames\n", ctlr->nframes); --- /sys/src/9/kw/usbehci.h Sat Sep 21 21:30:52 2013 +++ /sys/src/9/kw/usbehci.h Sat Sep 21 21:30:53 2013 @@ -61,41 +61,41 @@ */ struct Eopio { - ulong cmd; /* 00 command */ - ulong sts; /* 04 status */ - ulong intr; /* 08 interrupt enable */ - ulong frno; /* 0c frame index */ - ulong seg; /* 10 bits 63:32 of EHCI datastructs (unused) */ - ulong frbase; /* 14 frame list base pa (note: just 32 bits), 4096-byte boundary */ - ulong link; /* 18 link for async list */ + u32int cmd; /* 00 command */ + u32int sts; /* 04 status */ + u32int intr; /* 08 interrupt enable */ + u32int frno; /* 0c frame index */ + u32int seg; /* 10 bits 63:32 of EHCI datastructs (unused) */ + u32int frbase; /* 14 frame list base pa (note: just 32 bits), 4096-byte boundary */ + u32int link; /* 18 link for async list */ uchar d2c[0x40-0x1c]; /* 1c dummy */ - ulong config; /* 40 1: all ports default-routed to this HC */ - ulong portsc[1]; /* 44 Port status and control, one per port */ + u32int config; /* 40 1: all ports default-routed to this HC */ + u32int portsc[1]; /* 44 Port status and control, one per port */ /* * these are present on the Kirkwood USB controller. * are they standard now? Marvell doesn't document them publically. */ uchar _pad0[0x64-0x48]; - ulong otgsc; - ulong usbmode; - ulong epsetupsts; - ulong epprime; - ulong epflush; - ulong epsts; - ulong epcompl; - ulong epctl[6]; + u32int otgsc; + u32int usbmode; + u32int epsetupsts; + u32int epprime; + u32int epflush; + u32int epsts; + u32int epcompl; + u32int epctl[6]; /* freescale registers */ uchar _pad1[0x2c0-0x98]; - ulong snoop1; - ulong snoop2; - ulong agecntthresh; - ulong prictl; /* priority control */ - ulong sictl; /* system interface control */ + u32int snoop1; + u32int snoop2; + u32int agecntthresh; + u32int prictl; /* priority control */ + u32int sictl; /* system interface control */ uchar _pad2[0x3c0-0x2d4]; - ulong ctl; + u32int ctl; }; extern int ehcidebug; --- /sys/src/9/omap/usbehci.h Sat Sep 21 21:30:54 2013 +++ /sys/src/9/omap/usbehci.h Sat Sep 21 21:30:54 2013 @@ -61,20 +61,20 @@ */ struct Eopio { - ulong cmd; /* 00 command */ - ulong sts; /* 04 status */ - ulong intr; /* 08 interrupt enable */ - ulong frno; /* 0c frame index */ - ulong seg; /* 10 bits 63:32 of EHCI datastructs (unused) */ - ulong frbase; /* 14 frame list base pa (note: just 32 bits), 4096-byte boundary */ - ulong link; /* 18 link for async list */ + u32int cmd; /* 00 command */ + u32int sts; /* 04 status */ + u32int intr; /* 08 interrupt enable */ + u32int frno; /* 0c frame index */ + u32int seg; /* 10 bits 63:32 of EHCI datastructs (unused) */ + u32int frbase; /* 14 frame list base pa (note: just 32 bits), 4096-byte boundary */ + u32int link; /* 18 link for async list */ uchar d2c[0x40-0x1c]; /* 1c dummy */ - ulong config; /* 40 1: all ports default-routed to this HC */ - ulong portsc[3]; /* 44 Port status and control, one per port */ + u32int config; /* 40 1: all ports default-routed to this HC */ + u32int portsc[3]; /* 44 Port status and control, one per port */ /* defined for omap35 ehci at least */ uchar _pad0[0x80 - 0x50]; - ulong insn[6]; /* implementation-specific */ + u32int insn[6]; /* implementation-specific */ }; typedef struct Uhh Uhh; --- /sys/src/9/pc/usbehci.h Sat Sep 21 21:30:55 2013 +++ /sys/src/9/pc/usbehci.h Sat Sep 21 21:30:56 2013 @@ -62,16 +62,16 @@ */ struct Eopio { - ulong cmd; /* 00 command */ - ulong sts; /* 04 status */ - ulong intr; /* 08 interrupt enable */ - ulong frno; /* 0c frame index */ - ulong seg; /* 10 bits 63:32 of EHCI datastructs (unused) */ - ulong frbase; /* 14 frame list base pa (note: just 32 bits), 4096-byte boundary */ - ulong link; /* 18 link for async list */ + u32int cmd; /* 00 command */ + u32int sts; /* 04 status */ + u32int intr; /* 08 interrupt enable */ + u32int frno; /* 0c frame index */ + u32int seg; /* 10 bits 63:32 of EHCI datastructs (unused) */ + u32int frbase; /* 14 frame list base pa (note: just 32 bits), 4096-byte boundary */ + u32int link; /* 18 link for async list */ uchar d2c[0x40-0x1c]; /* 1c dummy */ - ulong config; /* 40 1: all ports default-routed to this HC */ - ulong portsc[1]; /* 44 Port status and control, one per port */ + u32int config; /* 40 1: all ports default-routed to this HC */ + u32int portsc[1]; /* 44 Port status and control, one per port */ }; extern int ehcidebug; --- /sys/src/9/pcpae/usbehci.h Sat Sep 21 21:30:57 2013 +++ /sys/src/9/pcpae/usbehci.h Sat Sep 21 21:30:57 2013 @@ -62,16 +62,16 @@ */ struct Eopio { - ulong cmd; /* 00 command */ - ulong sts; /* 04 status */ - ulong intr; /* 08 interrupt enable */ - ulong frno; /* 0c frame index */ - ulong seg; /* 10 bits 63:32 of EHCI datastructs (unused) */ - ulong frbase; /* 14 frame list base pa (note: just 32 bits), 4096-byte boundary */ - ulong link; /* 18 link for async list */ + u32int cmd; /* 00 command */ + u32int sts; /* 04 status */ + u32int intr; /* 08 interrupt enable */ + u32int frno; /* 0c frame index */ + u32int seg; /* 10 bits 63:32 of EHCI datastructs (unused) */ + u32int frbase; /* 14 frame list base pa (note: just 32 bits), 4096-byte boundary */ + u32int link; /* 18 link for async list */ uchar d2c[0x40-0x1c]; /* 1c dummy */ - ulong config; /* 40 1: all ports default-routed to this HC */ - ulong portsc[1]; /* 44 Port status and control, one per port */ + u32int config; /* 40 1: all ports default-routed to this HC */ + u32int portsc[1]; /* 44 Port status and control, one per port */ }; extern int ehcidebug; --- /sys/src/9/teg2/usbehci.h Sat Sep 21 21:30:58 2013 +++ /sys/src/9/teg2/usbehci.h Sat Sep 21 21:30:59 2013 @@ -61,20 +61,20 @@ */ struct Eopio { - ulong cmd; /* 00 command */ - ulong sts; /* 04 status */ - ulong intr; /* 08 interrupt enable */ - ulong frno; /* 0c frame index */ - ulong seg; /* 10 bits 63:32 of EHCI datastructs (unused) */ - ulong frbase; /* 14 frame list base pa (note: just 32 bits), 4096-byte boundary */ - ulong link; /* 18 link for async list */ + u32int cmd; /* 00 command */ + u32int sts; /* 04 status */ + u32int intr; /* 08 interrupt enable */ + u32int frno; /* 0c frame index */ + u32int seg; /* 10 bits 63:32 of EHCI datastructs (unused) */ + u32int frbase; /* 14 frame list base pa (note: just 32 bits), 4096-byte boundary */ + u32int link; /* 18 link for async list */ uchar d2c[0x40-0x1c]; /* 1c dummy */ - ulong config; /* 40 1: all ports default-routed to this HC */ - ulong portsc[3]; /* 44 Port status and control, one per port */ + u32int config; /* 40 1: all ports default-routed to this HC */ + u32int portsc[3]; /* 44 Port status and control, one per port */ /* defined for omap35 ehci at least */ uchar _pad0[0x80 - 0x50]; - ulong insn[6]; /* implementation-specific */ + u32int insn[6]; /* implementation-specific */ }; enum {