# HG changeset patch # User Louis Opter # Date 1353653245 28800 # Node ID e2c237d6c37b9b338170bbfaf69f9312ddf5b545 # Parent 147519512c3df06abfd441ec1f15930d31b3caf4 Update patches against David's new decl system diff -r 147519512c3d -r e2c237d6c37b rathaxes_cleanups_in_ethernet_rti_blt.patch --- a/rathaxes_cleanups_in_ethernet_rti_blt.patch Thu Nov 22 16:41:18 2012 -0800 +++ b/rathaxes_cleanups_in_ethernet_rti_blt.patch Thu Nov 22 22:47:25 2012 -0800 @@ -1,5 +1,5 @@ # HG changeset patch -# Parent 6cc56c206e65a31121a9e9745003fed8276b0b60 +# Parent 47ae8b89654899f0d6e2c0d656ca52c996d53262 rathaxes: tidy up ethernet.{rti,blt} in the e1000 sample - Remove typedefs; @@ -11,7 +11,7 @@ diff --git a/rathaxes/samples/e1000/e1000.blt b/rathaxes/samples/e1000/e1000.blt --- a/rathaxes/samples/e1000/e1000.blt +++ b/rathaxes/samples/e1000/e1000.blt -@@ -284,7 +284,7 @@ +@@ -267,7 +267,7 @@ }; } @@ -23,21 +23,21 @@ diff --git a/rathaxes/samples/e1000/e1000.rti b/rathaxes/samples/e1000/e1000.rti --- a/rathaxes/samples/e1000/e1000.rti +++ b/rathaxes/samples/e1000/e1000.rti -@@ -9,7 +9,7 @@ +@@ -7,7 +7,7 @@ + + provided type Context { - method decl(); - - chunk Ethernet::SubContext(); + chunk Ethernet::HardwareContext(); + decl data_types(); + method init(); - /* Callbacks/Hooks which should probably be in the front-end: */ - chunk Ethernet::adapter_init_context(Ethernet::Device, diff --git a/rathaxes/samples/e1000/ethernet.blt b/rathaxes/samples/e1000/ethernet.blt --- a/rathaxes/samples/e1000/ethernet.blt +++ b/rathaxes/samples/e1000/ethernet.blt @@ -59,7 +59,7 @@ - chunk ::decl() + decl data_types() { - typedef struct net_device *net_devp; + struct net_device; @@ -46,7 +46,7 @@ map @@ -76,14 +76,7 @@ - chunk ::decl() + decl data_types() { - /* - * So, at first sight, it sucks to typedef it as pointer but (for @@ -70,7 +70,7 @@ + }; } - chunk ::init(Ethernet::AbstractDevice net_dev, PCI::AbstractDevice pci_dev) + method init(Ethernet::AbstractDevice net_dev, PCI::AbstractDevice pci_dev) @@ -105,7 +98,7 @@ ${self} = netdev_priv(${net_dev}); /* @@ -162,7 +162,7 @@ +++ b/rathaxes/samples/e1000/ethernet.rti @@ -22,7 +22,7 @@ chunk LKM::includes(); - method decl(); + decl data_types(); method init(Ethernet::AbstractDevice, PCI::AbstractDevice); - pointcut Ethernet::SubContext(); + pointcut Ethernet::HardwareContext(); diff -r 147519512c3d -r e2c237d6c37b rathaxes_housekeeping_in_the_e1000_sample.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rathaxes_housekeeping_in_the_e1000_sample.patch Thu Nov 22 22:47:25 2012 -0800 @@ -0,0 +1,176 @@ +# HG changeset patch +# Parent b18529e8c43ef374112772b5caaec1089d50e57b +rathaxes: a little bit of cleanup in the e1000 sample + +- Remove an old & useless comment; +- Keep the decl block on top in the types templates. + + +diff --git a/rathaxes/samples/e1000/e1000.blt b/rathaxes/samples/e1000/e1000.blt +--- a/rathaxes/samples/e1000/e1000.blt ++++ b/rathaxes/samples/e1000/e1000.blt +@@ -2,11 +2,6 @@ + { + template type e1000::RxDescriptor() + { +- chunk LKM::includes() +- { +- #include +- } +- + decl data_types() + { + struct rtx_e1000_rx_descriptor +@@ -20,7 +15,12 @@ + }; + } + +- method init() ++ chunk LKM::includes() ++ { ++ #include ++ } ++ ++ method init() + { + } + +diff --git a/rathaxes/samples/e1000/ethernet.blt b/rathaxes/samples/e1000/ethernet.blt +--- a/rathaxes/samples/e1000/ethernet.blt ++++ b/rathaxes/samples/e1000/ethernet.blt +@@ -2,6 +2,11 @@ + { + template type Ethernet::ProtocolId() + { ++ decl data_types() ++ { ++ typedef unsigned short rtx_ether_protocol_id; ++ } ++ + chunk LKM::prototypes() + { + static const char *rtx_ethernet_protocol_id_to_str(unsigned short); +@@ -35,11 +40,6 @@ + } + } + +- decl data_types() +- { +- typedef unsigned short rtx_ether_protocol_id; +- } +- + method to_str() + { + rtx_ethernet_protocol_id_to_str(${self}); +@@ -52,16 +52,16 @@ + + template type Ethernet::AbstractDevice() + { ++ decl data_types() ++ { ++ struct net_device; ++ } ++ + chunk LKM::includes() + { + #include + } + +- decl data_types() +- { +- struct net_device; +- } +- + map + { + } +@@ -69,11 +69,6 @@ + + template type Ethernet::Device() + { +- chunk LKM::includes() +- { +- #include +- } +- + decl data_types() + { + struct rtx_ethernet_dev +@@ -93,6 +88,11 @@ + }; + } + ++ chunk LKM::includes() ++ { ++ #include ++ } ++ + method init(Ethernet::AbstractDevice net_dev, PCI::AbstractDevice pci_dev) + { + ${self} = netdev_priv(${net_dev}); +diff --git a/rathaxes/samples/e1000/pci.blt b/rathaxes/samples/e1000/pci.blt +--- a/rathaxes/samples/e1000/pci.blt ++++ b/rathaxes/samples/e1000/pci.blt +@@ -2,16 +2,16 @@ + { + template type PCI::AbstractDevice() + { ++ decl data_types() ++ { ++ struct pci_dev; ++ } ++ + chunk LKM::includes() + { + #include + } + +- decl data_types() +- { +- struct pci_dev; +- } +- + method init(PCI::AbstractDevice) + { + } +@@ -41,14 +41,6 @@ + }; + } + +- method init(PCI::AbstractDevice pdev) +- { +- ${self}->pdev = ${pdev}; +- ${self}->bars = pci_select_bars(${pdev}, IORESOURCE_MEM); +- ${self}->ioaddr = NULL; +- ${self}->context = NULL; +- } +- + chunk LKM::prototypes() + { + static int rtx_pci_device_enable(struct rtx_pci_dev *); +@@ -79,6 +71,14 @@ + } + } + ++ method init(PCI::AbstractDevice pdev) ++ { ++ ${self}->pdev = ${pdev}; ++ ${self}->bars = pci_select_bars(${pdev}, IORESOURCE_MEM); ++ ${self}->ioaddr = NULL; ++ ${self}->context = NULL; ++ } ++ + method enable() + { + rtx_pci_device_enable(${self}); +@@ -225,10 +225,6 @@ + { + chunk LKM::data() + { +- /* +- * CNorm doesn't seem to like "dynamic" arrays (i.e: you always +- * have to specify the exact size). +- */ + static struct pci_device_id rtx_pci_device_table[] = { + { ${config.vendor_id}, ${config.product_id}, PCI_ANY_ID, PCI_ANY_ID }, + { 0, } diff -r 147519512c3d -r e2c237d6c37b rathaxes_rename_pci_device_to_pci_abstractdevice.patch --- a/rathaxes_rename_pci_device_to_pci_abstractdevice.patch Thu Nov 22 16:41:18 2012 -0800 +++ b/rathaxes_rename_pci_device_to_pci_abstractdevice.patch Thu Nov 22 22:47:25 2012 -0800 @@ -1,15 +1,14 @@ # HG changeset patch -# Parent 71f853429e57cb8926fb03e2cacf04a45ad4e8dd +# Parent 4fad2a334860f1c79c7f735c48cd70f6bcadbcad rathaxes: rename PCI::Device to PCI::AbstractDevice in the e1000 sample To respect my "new" convention of prefixing Rathaxes types that just map types from the kernel with "Abstract". - diff --git a/rathaxes/samples/e1000/e1000.blt b/rathaxes/samples/e1000/e1000.blt --- a/rathaxes/samples/e1000/e1000.blt +++ b/rathaxes/samples/e1000/e1000.blt -@@ -479,7 +479,7 @@ +@@ -447,7 +447,7 @@ template sequence e1000::create_device() { @@ -18,7 +17,7 @@ { /* * PCI init stuff: -@@ -547,7 +547,7 @@ +@@ -515,7 +515,7 @@ template sequence e1000::destroy_device() { @@ -30,7 +29,7 @@ diff --git a/rathaxes/samples/e1000/e1000.rti b/rathaxes/samples/e1000/e1000.rti --- a/rathaxes/samples/e1000/e1000.rti +++ b/rathaxes/samples/e1000/e1000.rti -@@ -78,13 +78,13 @@ +@@ -72,13 +72,13 @@ provided sequence create_device() { @@ -62,8 +61,8 @@ } *rtx_ethernet_dev_p; } -- chunk ::init(Ethernet::AbstractDevice net_dev, PCI::Device pci_dev) -+ chunk ::init(Ethernet::AbstractDevice net_dev, PCI::AbstractDevice pci_dev) +- method init(Ethernet::AbstractDevice net_dev, PCI::Device pci_dev) ++ method init(Ethernet::AbstractDevice net_dev, PCI::AbstractDevice pci_dev) { ${self} = netdev_priv(${net_dev}); /* @@ -89,7 +88,7 @@ --- a/rathaxes/samples/e1000/ethernet.rti +++ b/rathaxes/samples/e1000/ethernet.rti @@ -17,16 +17,11 @@ - method decl(); + decl data_types(); } - /* @@ -100,7 +99,7 @@ provided type Device { chunk LKM::includes(); - method decl(); + decl data_types(); - method init(Ethernet::AbstractDevice, PCI::Device); + method init(Ethernet::AbstractDevice, PCI::AbstractDevice); pointcut Ethernet::SubContext(); @@ -141,8 +140,8 @@ struct pci_dev; } -- chunk ::init(PCI::Device) -+ chunk ::init(PCI::AbstractDevice) +- method init(PCI::Device) ++ method init(PCI::AbstractDevice) { } @@ -174,7 +173,7 @@ + provided type PCI::AbstractDevice { chunk LKM::includes(); - method decl(); + decl data_types(); - method init(PCI::Device); + method init(PCI::AbstractDevice); } diff -r 147519512c3d -r e2c237d6c37b rathaxes_rewrite_create_and_destroy_device_in_the_e1000_sample.patch --- a/rathaxes_rewrite_create_and_destroy_device_in_the_e1000_sample.patch Thu Nov 22 16:41:18 2012 -0800 +++ b/rathaxes_rewrite_create_and_destroy_device_in_the_e1000_sample.patch Thu Nov 22 22:47:25 2012 -0800 @@ -1,5 +1,5 @@ # HG changeset patch -# Parent d65cd0228e5c25692e6f37d0524e61ae26102a33 +# Parent 23c454cb9c1efef0cdcb239505343e893bcd6303 rathaxes: rehaul the device initialization/destruction in the e1000 sample - Add several chunks on the e1000::Context; these chunks perform @@ -21,65 +21,59 @@ { template type e1000::RxDescriptor() { -@@ -268,6 +268,22 @@ +@@ -251,22 +251,8 @@ template type e1000::Context() { -+ chunk ::decl() -+ { -+ struct rtx_e1000_ctx -+ { -+ int bars; -+ unsigned char /* __iomem */ *ioaddr; -+ unsigned int irq; -+ -+ /* we can't use the Rathaxes type here (#8) */ -+ //${e1000::RxRing} rx_ring; -+ //${e1000::TxRing} tx_ring; -+ struct rtx_e1000_rx_ring rx_ring; -+ struct rtx_e1000_tx_ring tx_ring; -+ }; -+ } -+ - chunk Ethernet::SubContext() - { - /* -@@ -278,28 +294,58 @@ - ${e1000::Context} hw_ctx; - } - -- chunk ::decl() -+ chunk Ethernet::adapter_init_context(Ethernet::Device rtx_ether_ctx, -+ Builtin::number bars, -+ Builtin::symbol ioaddr, -+ Builtin::number irq) +- chunk Ethernet::SubContext() +- { +- /* +- * Force the generation of the structure in the "headers" part, we +- * have to do this since we do not use the structure in this blt +- * (we hacked a bit and used it in ethernet.blt directly). +- */ +- ${e1000::Context} hw_ctx; +- } +- + decl data_types() { - /* - * Yes, this typedef looks ugly but read the remark about - * Ethernet::Device in ethernet.blt. - */ -- struct rtx_e1000_ctx + struct rtx_e1000_ctx { -- int bars; -- unsigned char /* __iomem */ *ioaddr; -- int irq; -- -- /* we can't use the Rathaxes type here (#8) */ -- //${e1000::RxRing} rx_ring; -- //${e1000::TxRing} tx_ring; -- struct rtx_e1000_rx_ring rx_ring; -- struct rtx_e1000_tx_ring tx_ring; -- }; + int bars; +@@ -281,8 +267,68 @@ + }; + } + +- method init() ++ chunk Ethernet::SubContext() + { ++ /* ++ * Force the generation of the structure in the "headers" part, we ++ * have to do this since we do not use the structure in this blt ++ * (we hacked a bit and used it in ethernet.blt directly). ++ */ ++ ${e1000::Context} hw_ctx; ++ } ++ ++ chunk Ethernet::adapter_init_context(Ethernet::Device rtx_ether_ctx, ++ Builtin::number bars, ++ Builtin::symbol ioaddr, ++ Builtin::number irq) ++ { ++ { + struct rtx_e1000_ctx *hw_ctx = &${rtx_ether_ctx}->hw_ctx; + hw_ctx->bars = ${bars}; + hw_ctx->ioaddr = ${ioaddr}; + hw_ctx->irq = ${irq}; + } - } - -- chunk ::init() ++ } ++ + chunk Ethernet::adapter_reset(Ethernet::Device rtx_ether_ctx) - { ++ { + { + struct rtx_e1000_ctx *hw_ctx = &${rtx_ether_ctx}->hw_ctx; + rtx_e1000_register_write32(hw_ctx, E1000_CTRL, E1000_CMD_RST); @@ -120,7 +114,7 @@ } map -@@ -477,91 +523,6 @@ +@@ -445,91 +491,6 @@ } } @@ -224,29 +218,23 @@ required variable Builtin::number rx_ring_size; required variable Builtin::number tx_ring_size; required variable Builtin::number rx_buffer_len; -@@ -10,9 +7,18 @@ - - provided type Context - { -+ method decl(); -+ +@@ -13,6 +10,14 @@ chunk Ethernet::SubContext(); -- method decl(); -- method init(); + decl data_types(); + method init(); + + /* Callbacks/Hooks which should probably be in the front-end: */ + chunk Ethernet::adapter_init_context(Ethernet::Device, + Builtin::number, + Builtin::symbol, + Builtin::number); -+// chunk Ethernet::adapter_init_context(Ethernet::Device); + chunk Ethernet::adapter_reset(Ethernet::Device); + chunk Ethernet::adapter_load_mac_address(Ethernet::Device); } provided type RxDescriptor -@@ -76,18 +82,6 @@ - chunk ::decl(); +@@ -70,18 +75,6 @@ + decl data_types(); } - provided sequence create_device() @@ -409,7 +397,7 @@ required variable Builtin::string ifname; @@ -23,6 +23,9 @@ - method decl(); + decl data_types(); method init(Ethernet::AbstractDevice, PCI::AbstractDevice); pointcut Ethernet::SubContext(); + @@ -456,16 +444,16 @@ diff --git a/rathaxes/samples/e1000/pci.blt b/rathaxes/samples/e1000/pci.blt --- a/rathaxes/samples/e1000/pci.blt +++ b/rathaxes/samples/e1000/pci.blt -@@ -12,12 +12,102 @@ +@@ -12,15 +12,105 @@ struct pci_dev; } -- chunk ::init(PCI::AbstractDevice) -+ chunk ::init(PCI::AbstractDevice) +- method init(PCI::AbstractDevice) ++ method init(PCI::AbstractDevice) { } -+ chunk set_context(Builtin::symbol ctx) ++ method set_context(Builtin::symbol ctx) + { + pci_set_drvdata(${self}, ${ctx}); + } @@ -473,12 +461,12 @@ map { + context: pci_get_drvdata(${self}); -+ } -+ } -+ + } + } + + template type PCI::Device() + { -+ chunk ::decl() ++ decl data_types() + { + struct rtx_pci_dev + { @@ -490,7 +478,7 @@ + }; + } + -+ chunk ::init(PCI::AbstractDevice pdev) ++ method init(PCI::AbstractDevice pdev) + { + ${self}->pdev = ${pdev}; + ${self}->bars = pci_select_bars(${pdev}, IORESOURCE_MEM); @@ -528,22 +516,22 @@ + } + } + -+ chunk enable() ++ method enable() + { + rtx_pci_device_enable(${self}); + } + -+ chunk disable() ++ method disable() + { + rtx_pci_device_disable(${self}); + } + -+ chunk select_ioaddr(Builtin::number bar) ++ method select_ioaddr(Builtin::number bar) + { + ${self}->ioaddr = pci_ioremap_bar(${self}->pdev, ${bar}); + } + -+ chunk set_context(Builtin::symbol ctx) ++ method set_context(Builtin::symbol ctx) + { + ${self}->context = ctx; + } @@ -557,9 +545,12 @@ + bars: ${self}->bars; + ioaddr: ${self}->ioaddr; + BAR_0: 0; - } - } - ++ } ++ } ++ + template sequence probe() + { + chunk LKM::prototypes() @@ -34,24 +124,67 @@ static int /* __devinit */ rtx_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pdev_id) @@ -659,7 +650,7 @@ diff --git a/rathaxes/samples/e1000/pci.rti b/rathaxes/samples/e1000/pci.rti --- a/rathaxes/samples/e1000/pci.rti +++ b/rathaxes/samples/e1000/pci.rti -@@ -1,14 +1,40 @@ +@@ -1,14 +1,41 @@ -interface PCI : LKM +interface PCI : LKM, Builtin, Device { @@ -669,9 +660,10 @@ + provided type PCI::AbstractDevice { - chunk LKM::includes(); ++ decl data_types(); + - method decl(); + chunk LKM::includes(); +- decl data_types(); method init(PCI::AbstractDevice); + method set_context(Builtin::symbol); + @@ -682,10 +674,11 @@ - required variable Builtin::number PCI::product_id; + provided type PCI::Device + { ++ decl data_types(); ++ + chunk LKM::prototypes(); + chunk LKM::code(); + -+ method decl(); + method init(PCI::AbstractDevice); + method enable(); + method disable(); @@ -703,7 +696,7 @@ provided sequence register() { -@@ -28,7 +54,7 @@ +@@ -28,7 +55,7 @@ provided chunk LKM::prototypes(); provided chunk LKM::code(); @@ -712,7 +705,7 @@ } provided sequence remove() -@@ -36,6 +62,6 @@ +@@ -36,6 +63,6 @@ provided chunk LKM::prototypes(); provided chunk LKM::code(); diff -r 147519512c3d -r e2c237d6c37b series --- a/series Thu Nov 22 16:41:18 2012 -0800 +++ b/series Thu Nov 22 22:47:25 2012 -0800 @@ -3,3 +3,4 @@ rathaxes_remove_useless_xmit_tso_cksum_offload_method_from_e1000.patch rathaxes_rewrite_create_and_destroy_device_in_the_e1000_sample.patch rathaxes_cleanups_in_ethernet_rti_blt.patch +rathaxes_housekeeping_in_the_e1000_sample.patch