Mercurial > archived > louis > epitech > mq > rathaxes
comparison rathaxes_sample_e1000_rewrite_device_dependent_code.patch @ 134:79226bb06e6a
Wip
author | Louis Opter <kalessin@kalessin.fr> |
---|---|
date | Sat, 11 Jan 2014 16:34:30 -0800 |
parents | dbb4a3b383cb |
children | 9c6ae3a2e180 |
comparison
equal
deleted
inserted
replaced
133:dbb4a3b383cb | 134:79226bb06e6a |
---|---|
53 @@ -890,6 +890,8 @@ | 53 @@ -890,6 +890,8 @@ |
54 local to_remove; | 54 local to_remove; |
55 foreach placeHolder in local_node.body.compile | 55 foreach placeHolder in local_node.body.compile |
56 { | 56 { |
57 + if (!placeHolder.node.body.type) | 57 + if (!placeHolder.node.body.type) |
58 + traceLine(RED + "BUG: placeHolder.node.body.type is missing in rtxIntrospect_walk<\"__rtx_chunk__\">" + DEFAULT_COLOR); | 58 + traceLine(RED + "BUG: placeHolder.node.body.type is missing in rtxIntrospect_walk<\"__rtx_chunk__\">, placeHolder = " + toString(placeHolder) + DEFAULT_COLOR); |
59 if (rtxIntrospect_InferPlaceHolderTypes<placeHolder.node.body.type>(placeHolder.node.body, local_node) == false) | 59 if (rtxIntrospect_InferPlaceHolderTypes<placeHolder.node.body.type>(placeHolder.node.body, local_node) == false) |
60 { | 60 { |
61 pushItem to_remove; | 61 pushItem to_remove; |
62 diff --git a/rathaxes/compiler/passes/back/rtxPlaceHolders.inc.cws b/rathaxes/compiler/passes/back/rtxPlaceHolders.inc.cws | 62 diff --git a/rathaxes/compiler/passes/back/rtxPlaceHolders.inc.cws b/rathaxes/compiler/passes/back/rtxPlaceHolders.inc.cws |
63 --- a/rathaxes/compiler/passes/back/rtxPlaceHolders.inc.cws | 63 --- a/rathaxes/compiler/passes/back/rtxPlaceHolders.inc.cws |
694 - decl data_types() | 694 - decl data_types() |
695 + decl data_types() | 695 + decl data_types() |
696 { | 696 { |
697 E1000_TXD_DTYP_D = 0x00100000, /* Data Descriptor */ | 697 E1000_TXD_DTYP_D = 0x00100000, /* Data Descriptor */ |
698 E1000_TXD_DTYP_C = 0x00000000, /* Context Descriptor */ | 698 E1000_TXD_DTYP_C = 0x00000000, /* Context Descriptor */ |
699 @@ -701,326 +140,656 @@ | 699 @@ -701,326 +140,683 @@ |
700 } | 700 } |
701 } | 701 } |
702 | 702 |
703 - /* TODO: make that a method of e1000::Context */ | 703 - /* TODO: make that a method of e1000::Context */ |
704 - template sequence e1000::print_status(Ethernet::Device rtx_ether_ctx) | 704 - template sequence e1000::print_status(Ethernet::Device rtx_ether_ctx) |
778 + | 778 + |
779 + template type e1000::Context() | 779 + template type e1000::Context() |
780 + { | 780 + { |
781 + decl data_types() | 781 + decl data_types() |
782 + { | 782 + { |
783 + unsigned char *io_addr; // XXX should be annoted with __iomem | 783 + ${Ethernet::Device.ref} net_dev; |
784 + // XXX should be annoted with __iomem: | |
785 + unsigned char *io_addr; | |
784 + // XXX Forced to hardcode the type because there is a circular | 786 + // XXX Forced to hardcode the type because there is a circular |
785 + // dependency between the rings and the context. | 787 + // dependency between the rings and the context. |
786 + // TODO: get the right generated types: | 788 + // TODO: get the right generated types: |
787 + int tx_ring; | 789 + int tx_ring; |
788 + int rx_ring; | 790 + int rx_ring; |
789 + } | 791 + } |
790 + | 792 + |
791 + chunk LKM::includes() | 793 + chunk LKM::includes() |
792 + { | 794 + { |
793 + #include <linux/types.h> | 795 + #include <linux/types.h> |
834 + | 836 + |
835 + static void rtx_e1000_reg_write32(${e1000::Context} self, | 837 + static void rtx_e1000_reg_write32(${e1000::Context} self, |
836 + ${e1000::Register} reg, | 838 + ${e1000::Register} reg, |
837 + unsigned int value) | 839 + unsigned int value) |
838 + { | 840 + { |
839 + return iowrite32(value, ${local.self.io_addr.io} + reg); | 841 + return iowrite32(value, ${local.self.io_addr} + reg); |
840 + } | 842 + } |
841 + | 843 + |
842 + static void rtx_e1000_reg_set32(${e1000::Context} self, | 844 + static void rtx_e1000_reg_set32(${e1000::Context} self, |
843 + ${e1000::Register} reg, | 845 + ${e1000::Register} reg, |
844 + unsigned int value) | 846 + unsigned int value) |
845 + { | 847 + { |
846 + return iowrite32( | 848 + return iowrite32( |
847 + rtx_e1000_reg_read32(${local.self}, reg) | value, | 849 + rtx_e1000_reg_read32(${local.self}, reg) | value, |
848 + ${local.self.io_addr.io} + reg | 850 + ${local.self.io_addr} + reg |
849 + ); | 851 + ); |
850 + } | 852 + } |
851 + | 853 + |
852 + static void rtx_e1000_reg_unset32(${e1000::Context} self, | 854 + static void rtx_e1000_reg_unset32(${e1000::Context} self, |
853 + ${e1000::Register} reg, | 855 + ${e1000::Register} reg, |
854 + unsigned int value) | 856 + unsigned int value) |
855 + { | 857 + { |
856 + return iowrite32(rtx_e1000_reg_read32( | 858 + return iowrite32(rtx_e1000_reg_read32( |
857 + ${local.self}, reg) & ~value, | 859 + ${local.self}, reg) & ~value, |
858 + ${local.self.io_addr.io} + reg | 860 + ${local.self.io_addr} + reg |
859 + ); | 861 + ); |
860 + } | 862 + } |
861 } | 863 } |
862 | 864 |
863 - chunk ::CALL() | 865 - chunk ::CALL() |
864 + method init(Builtin::symbol io_addr) | 866 + method init(Ethernet::Device rtx_ether_ctx, Builtin::symbol io_addr) |
865 { | 867 { |
866 - rtx_e1000_print_status(&${rtx_ether_ctx}->hw_ctx); | 868 - rtx_e1000_print_status(&${rtx_ether_ctx}->hw_ctx); |
869 + ${self.net_dev} = ${rtx_ether_ctx}; | |
867 + ${self.io_addr} = ${io_addr}; | 870 + ${self.io_addr} = ${io_addr}; |
868 + } | 871 + } |
869 + | 872 + |
870 + method reg_read32(e1000::Register reg) | 873 + method reg_read32(e1000::Register reg) |
871 + { | 874 + { |
894 + | 897 + |
895 + chunk Ethernet::adapter_init_context(Ethernet::Device rtx_ether_ctx, Builtin::symbol io_addr) | 898 + chunk Ethernet::adapter_init_context(Ethernet::Device rtx_ether_ctx, Builtin::symbol io_addr) |
896 + { | 899 + { |
897 + { | 900 + { |
898 + ${e1000::Context.ref} hw_ctx = &${local.rtx_ether_ctx}->hw_ctx; | 901 + ${e1000::Context.ref} hw_ctx = &${local.rtx_ether_ctx}->hw_ctx; |
899 + ${local.hw_ctx.init(local.io_addr)}; | 902 + ${local.hw_ctx.init(local.rtx_ether_ctx, local.io_addr)}; |
900 + ${local.hw_ctx.rx_ring.init(local.hw_ctx.io, config.rx_ring_size)}; | 903 + ${local.hw_ctx.rx_ring.init(local.hw_ctx.io, config.rx_ring_size)}; |
901 + ${local.hw_ctx.tx_ring.init(local.hw_ctx.io, config.tx_ring_size)}; | 904 + ${local.hw_ctx.tx_ring.init(local.hw_ctx.io, config.tx_ring_size)}; |
902 + } | 905 + } |
903 + } | 906 + } |
904 + | 907 + |
1012 + // XXX #46: ${local.hw_ctx.print_status()}; | 1015 + // XXX #46: ${local.hw_ctx.print_status()}; |
1013 + rtx_e1000_print_status(hw_ctx); | 1016 + rtx_e1000_print_status(hw_ctx); |
1014 + } | 1017 + } |
1015 + } | 1018 + } |
1016 + | 1019 + |
1017 + chunk Ethernet::disable_interrupts(Ethernet::Device rtx_ether_ctx) | 1020 + chunk Ethernet::adapter_disable_interrupts(Ethernet::Device rtx_ether_ctx) |
1018 + { | 1021 + { |
1019 + { ${Log::info("adapter_disable_interrupts: TBD...")}; } | 1022 + { ${Log::info("adapter_disable_interrupts: TBD...")}; } |
1020 + } | 1023 + } |
1021 + | 1024 + |
1022 + chunk Ethernet::adapter_handle_interrupt(Ethernet::Device rtx_ether_ctx) | 1025 + chunk Ethernet::adapter_handle_interrupt(Ethernet::Device rtx_ether_ctx) |
1055 + chunk Ethernet::adapter_disable_rx(Ethernet::Device rtx_ether_ctx) | 1058 + chunk Ethernet::adapter_disable_rx(Ethernet::Device rtx_ether_ctx) |
1056 + { | 1059 + { |
1057 + { ${Log::info("adapter_disable_rx: TBD..")}; } | 1060 + { ${Log::info("adapter_disable_rx: TBD..")}; } |
1058 + } | 1061 + } |
1059 + | 1062 + |
1060 + chunk Ethernet::adpater_disable_tx(Ethernet::Device rtx_ether_ctx) | 1063 + chunk Ethernet::adapter_disable_tx(Ethernet::Device rtx_ether_ctx) |
1061 + { | 1064 + { |
1062 + { ${Log::info("adapter_disable_tx: TBD..")}; } | 1065 + { ${Log::info("adapter_disable_tx: TBD..")}; } |
1063 + } | 1066 + } |
1064 + | 1067 + |
1065 + chunk Ethernet::adapter_free_rx_tx(Ethernet::Device rtx_ether_ctx) | 1068 + chunk Ethernet::adapter_free_rx_tx(Ethernet::Device rtx_ether_ctx) |
1075 + map | 1078 + map |
1076 + { | 1079 + { |
1077 + io_addr: ${self}->io; | 1080 + io_addr: ${self}->io; |
1078 + rx_ring: ${self}->rx_ring; | 1081 + rx_ring: ${self}->rx_ring; |
1079 + tx_ring: ${self}->tx_ring; | 1082 + tx_ring: ${self}->tx_ring; |
1083 + net_dev: ${self}->net_dev; | |
1080 } | 1084 } |
1081 } | 1085 } |
1082 | 1086 |
1083 - /* | 1087 - /* |
1084 - * We should have been able to do something along those lines, but | 1088 - * We should have been able to do something along those lines, but |
1166 + chunk LKM::prototypes() | 1170 + chunk LKM::prototypes() |
1167 { | 1171 { |
1168 - /* FIXME: See issue #54 */ | 1172 - /* FIXME: See issue #54 */ |
1169 - static void rtx_e1000_register_write32(/*const*/ ${e1000::Context.ref} ctx, unsigned int reg_offset, unsigned int value) | 1173 - static void rtx_e1000_register_write32(/*const*/ ${e1000::Context.ref} ctx, unsigned int reg_offset, unsigned int value) |
1170 + static int rtx_e1000_rx_ring_alloc_resources(${e1000::RxRing.ref}); | 1174 + static int rtx_e1000_rx_ring_alloc_resources(${e1000::RxRing.ref}); |
1175 + static void rtx_e1000_rx_ring_free_resources(${e1000::RxRing.ref}); | |
1171 + static void rtx_e1000_rx_ring_configure(${e1000::RxRing.ref}); | 1176 + static void rtx_e1000_rx_ring_configure(${e1000::RxRing.ref}); |
1172 + } | 1177 + } |
1173 + | 1178 + |
1174 + chunk LKM::code() | 1179 + chunk LKM::code() |
1175 + { | 1180 + { |
1215 + // ${Log::info("adapter_init_rx: skbuffs allocated}; | 1220 + // ${Log::info("adapter_init_rx: skbuffs allocated}; |
1216 + pr_info("rtx_e1k: adapter_init_rx: skbuffs allocated, headlen=%d", skb_headlen((struct sk_buff *)hw_ctx->rx_ring.skbuffs[i - 1].skbuff)); | 1221 + pr_info("rtx_e1k: adapter_init_rx: skbuffs allocated, headlen=%d", skb_headlen((struct sk_buff *)hw_ctx->rx_ring.skbuffs[i - 1].skbuff)); |
1217 + | 1222 + |
1218 + err_skbuffs_alloc: | 1223 + err_skbuffs_alloc: |
1219 + while (i--) { | 1224 + while (i--) { |
1220 + ${DMA::unmap( | 1225 +// XXX ${DMA::unmap( |
1221 + local.self.hw_ctx.net_dev.device, | 1226 +// local.self.hw_ctx.net_dev.device, |
1222 + // XXX Leaking cast because of the array: (TODO: the data structure changed) | 1227 +// // XXX Leaking cast because of the array: (TODO: the data structure changed) |
1223 + *((dma_addr_t *)&(self->buffs[i].dma_handle)), | 1228 +// *((dma_addr_t *)&(self->buffs[i].dma_handle)), |
1224 + ${config.rx_buffer_len}, | 1229 +// config.rx_buffer_len, |
1225 + RTX_DMA_FROM_DEVICE | 1230 +// RTX_DMA_FROM_DEVICE |
1226 + )}; | 1231 +// )}; |
1227 + err_skbuffs_map: | 1232 + err_skbuffs_map: |
1228 + // XXX leaking cast: (TODO: the data structure changed) | 1233 + // XXX leaking cast: (TODO: the data structure changed) |
1229 + dev_kfree_skb((struct sk_buff *)hw_ctx->rx_ring.skbuffs[i].skbuff); | 1234 + dev_kfree_skb((struct sk_buff *)hw_ctx->rx_ring.skbuffs[i].skbuff); |
1230 + } | 1235 + } |
1231 + | 1236 + |
1233 + local.self.hw_ctx.net_dev.device, local.self.size, | 1238 + local.self.hw_ctx.net_dev.device, local.self.size, |
1234 + local.self.descs, local.self.dma.dma_handle | 1239 + local.self.descs, local.self.dma.dma_handle |
1235 + )}; | 1240 + )}; |
1236 + err_rx_ring_alloc: | 1241 + err_rx_ring_alloc: |
1237 + return -ENOMEM; | 1242 + return -ENOMEM; |
1243 + } | |
1244 + | |
1245 + static void rtx_e1000_rx_ring_free_resources(${e1000::RxRing.ref} self) | |
1246 + { | |
1247 + ${Log::info("e1000_rx_ring_free_resources: TBD...")}; | |
1238 + } | 1248 + } |
1239 + | 1249 + |
1240 + static void rtx_e1000_rx_ring_configure(${e1000::RxRing.ref} self) | 1250 + static void rtx_e1000_rx_ring_configure(${e1000::RxRing.ref} self) |
1241 + { | 1251 + { |
1242 + // XXX Reread & Fix everything down there (data structure changes and so on) | 1252 + // XXX Reread & Fix everything down there (data structure changes and so on) |
1331 + method alloc() | 1341 + method alloc() |
1332 + { | 1342 + { |
1333 + rtx_e1000_rx_ring_alloc_resources(${self}); | 1343 + rtx_e1000_rx_ring_alloc_resources(${self}); |
1334 + } | 1344 + } |
1335 + | 1345 + |
1346 + method free() | |
1347 + { | |
1348 + rtx_e1000_rx_ring_free_resources(${self}); | |
1349 + } | |
1350 + | |
1336 + method configure() | 1351 + method configure() |
1337 + { | 1352 + { |
1338 + rtx_e1000_rx_ring_configure(${self}); | 1353 + rtx_e1000_rx_ring_configure(${self}); |
1339 + } | 1354 + } |
1340 + | 1355 + |
1365 + chunk LKM::prototypes() | 1380 + chunk LKM::prototypes() |
1366 { | 1381 { |
1367 - /* FIXME: See issue #54 */ | 1382 - /* FIXME: See issue #54 */ |
1368 - static void rtx_e1000_register_set32(/*const*/ ${e1000::Context.ref} ctx, unsigned int reg_offset, unsigned int value) | 1383 - static void rtx_e1000_register_set32(/*const*/ ${e1000::Context.ref} ctx, unsigned int reg_offset, unsigned int value) |
1369 + static int rtx_e1000_tx_ring_alloc_resources(${e1000::TxRing.ref}); | 1384 + static int rtx_e1000_tx_ring_alloc_resources(${e1000::TxRing.ref}); |
1385 + static void rtx_e1000_tx_ring_free_resources(${e1000::TxRing.ref}); | |
1370 + static void rtx_e1000_tx_ring_configure(${e1000::TxRing.ref}); | 1386 + static void rtx_e1000_tx_ring_configure(${e1000::TxRing.ref}); |
1371 + } | 1387 + } |
1372 + | 1388 + |
1373 + chunk LKM::code() | 1389 + chunk LKM::code() |
1374 + { | 1390 + { |
1375 + static int rtx_e1000_tx_ring_alloc_resources(${e1000::TxRing.ref} self) | 1391 + static int rtx_e1000_tx_ring_alloc_resources(${e1000::TxRing.ref} self) |
1376 { | 1392 { |
1377 - iowrite32(rtx_e1000_register_read32(ctx, reg_offset) | value, ctx->ioaddr + reg_offset); | 1393 - iowrite32(rtx_e1000_register_read32(ctx, reg_offset) | value, ctx->ioaddr + reg_offset); |
1394 + ${Log::info("e1000_tx_ring_alloc_resources: TBD...")}; | |
1378 + return 0; | 1395 + return 0; |
1396 + } | |
1397 + | |
1398 + static void rtx_e1000_tx_ring_free_resources(${e1000::TxRing.ref} self) | |
1399 + { | |
1400 + ${Log::info("e1000_tx_ring_free_resources: TBD...")}; | |
1379 + } | 1401 + } |
1380 + | 1402 + |
1381 + static void rtx_e1000_tx_ring_configure(${e1000::TxRing.ref} self) | 1403 + static void rtx_e1000_tx_ring_configure(${e1000::TxRing.ref} self) |
1382 + { | 1404 + { |
1383 + // return ; XXX wtf fails with: | 1405 + // return ; XXX wtf fails with: |
1411 - } | 1433 - } |
1412 + rtx_e1000_tx_ring_alloc_resources(${self}); | 1434 + rtx_e1000_tx_ring_alloc_resources(${self}); |
1413 } | 1435 } |
1414 | 1436 |
1415 - chunk ::CALL() | 1437 - chunk ::CALL() |
1416 + method configure() | 1438 + method free() |
1417 { | 1439 { |
1418 - rtx_e1000_register_unset32(${ctx}, ${reg_offset}, ${value}); | 1440 - rtx_e1000_register_unset32(${ctx}, ${reg_offset}, ${value}); |
1419 + rtx_e1000_tx_ring_configure(${self}); | 1441 + rtx_e1000_tx_ring_free_resources(${self}); |
1420 } | 1442 } |
1421 - } | 1443 - } |
1422 | 1444 |
1423 - template sequence activate_device_interruption(Ethernet::Device rtx_ether_ctx) | 1445 - template sequence activate_device_interruption(Ethernet::Device rtx_ether_ctx) |
1424 - { | 1446 - { |
1425 - chunk ::CALL() | 1447 - chunk ::CALL() |
1426 + map | 1448 + method configure() |
1427 { | 1449 { |
1428 - rtx_e1000_register_write32(&${rtx_ether_ctx}->hw_ctx, E1000_IMS, | 1450 - rtx_e1000_register_write32(&${rtx_ether_ctx}->hw_ctx, E1000_IMS, |
1429 - E1000_INTR_TXDW | | 1451 - E1000_INTR_TXDW | |
1430 - E1000_INTR_TXQE | | 1452 - E1000_INTR_TXQE | |
1431 - E1000_INTR_LSC | | 1453 - E1000_INTR_LSC | |
1432 - E1000_INTR_RXO | | 1454 - E1000_INTR_RXO | |
1433 - E1000_INTR_RXT0); | 1455 - E1000_INTR_RXT0); |
1434 - } | 1456 + rtx_e1000_tx_ring_configure(${self}); |
1457 } | |
1435 - } | 1458 - } |
1436 - | 1459 |
1437 - /* TODO: | 1460 - /* TODO: |
1438 - * | 1461 - * |
1439 - * Refactor into two methods (one in RxRing and one in TxRing) and make use | 1462 - * Refactor into two methods (one in RxRing and one in TxRing) and make use |
1440 - * of the new methods in Socket::SKBuff. | 1463 - * of the new methods in Socket::SKBuff. |
1441 - */ | 1464 - */ |
1442 - template sequence free_rx_tx(Ethernet::Device rtx_ether_ctx) | 1465 - template sequence free_rx_tx(Ethernet::Device rtx_ether_ctx) |
1443 - { | 1466 - { |
1444 - chunk ::CALL() | 1467 - chunk ::CALL() |
1445 - { | 1468 + map |
1469 { | |
1446 - /* | 1470 - /* |
1447 - * XXX: Not generated if named "hw_ctx" (which is funny because | 1471 - * XXX: Not generated if named "hw_ctx" (which is funny because |
1448 - * it's used and works in the template right above this one): | 1472 - * it's used and works in the template right above this one): |
1449 - */ | 1473 - */ |
1450 - ${e1000::Context.ref} hw_ctx_; | 1474 - ${e1000::Context.ref} hw_ctx_; |
1610 } | 1634 } |
1611 } | 1635 } |
1612 diff --git a/rathaxes/samples/e1000/e1000.rti b/rathaxes/samples/e1000/e1000.rti | 1636 diff --git a/rathaxes/samples/e1000/e1000.rti b/rathaxes/samples/e1000/e1000.rti |
1613 --- a/rathaxes/samples/e1000/e1000.rti | 1637 --- a/rathaxes/samples/e1000/e1000.rti |
1614 +++ b/rathaxes/samples/e1000/e1000.rti | 1638 +++ b/rathaxes/samples/e1000/e1000.rti |
1615 @@ -1,157 +1,122 @@ | 1639 @@ -1,157 +1,123 @@ |
1616 -interface e1000 : Socket, Ethernet, DMA, PCI, LKM, Builtin | 1640 -interface e1000 : Socket, Ethernet, DMA, PCI, LKM, Builtin |
1617 +interface e1000 : Socket, Ethernet, Device, DMA, PCI, LKM, Builtin | 1641 +interface e1000 : Socket, Ethernet, Device, DMA, PCI, LKM, Builtin |
1618 { | 1642 { |
1619 - required variable Builtin::number rx_ring_size; | 1643 - required variable Builtin::number rx_ring_size; |
1620 - required variable Builtin::number tx_ring_size; | 1644 - required variable Builtin::number tx_ring_size; |
1668 + chunk Ethernet::adapter_xmit(Ethernet::Device, Socket::SKBuff); | 1692 + chunk Ethernet::adapter_xmit(Ethernet::Device, Socket::SKBuff); |
1669 + chunk Ethernet::adapter_disable_rx(Ethernet::Device); | 1693 + chunk Ethernet::adapter_disable_rx(Ethernet::Device); |
1670 + chunk Ethernet::adapter_disable_tx(Ethernet::Device); | 1694 + chunk Ethernet::adapter_disable_tx(Ethernet::Device); |
1671 + chunk Ethernet::adapter_free_rx_tx(Ethernet::Device); | 1695 + chunk Ethernet::adapter_free_rx_tx(Ethernet::Device); |
1672 + | 1696 + |
1673 + method init(Builtin::symbol); | 1697 + method init(Ethernet::Device net_dev, Builtin::symbol); |
1674 + method print_status(); | 1698 + method print_status(); |
1675 + method reg_read32(Register); | 1699 + method reg_read32(Register); |
1676 + method reg_write32(Register, Builtin::number); | 1700 + method reg_write32(Register, Builtin::number); |
1677 + method reg_set32(Register, Builtin::number); | 1701 + method reg_set32(Register, Builtin::number); |
1678 + method reg_unset32(Register, Builtin::number); | 1702 + method reg_unset32(Register, Builtin::number); |
1680 + // XXX: Circular dependency with the rings, this will prevent us to | 1704 + // XXX: Circular dependency with the rings, this will prevent us to |
1681 + // call methods even when issue $46 is resolved, and it also forces | 1705 + // call methods even when issue $46 is resolved, and it also forces |
1682 + // us to hardcode generated types in the definition of the type: | 1706 + // us to hardcode generated types in the definition of the type: |
1683 + attribute Builtin::symbol.scalar rx_ring; | 1707 + attribute Builtin::symbol.scalar rx_ring; |
1684 + attribute Builtin::symbol.scalar tx_ring; | 1708 + attribute Builtin::symbol.scalar tx_ring; |
1685 + | 1709 + attribute Builtin::symbol.scalar io_addr; |
1686 + attribute Ethernet::Device.ref net_dev; | 1710 + attribute Ethernet::Device.ref net_dev; |
1687 + } | 1711 + } |
1688 + | 1712 + |
1689 + provided type Ring | 1713 + provided type Ring |
1690 + { | 1714 + { |
1691 + decl data_types(); | 1715 + decl data_types(); |
1692 + | 1716 + |
1693 + chunk LKM::prototypes(); | 1717 + chunk LKM::prototypes(); |
1694 + chunk LKM::code(); | 1718 + chunk LKM::code(); |
1695 + | 1719 + |
1696 + method init(e1000::Context, Builtin::number); | 1720 + method init(e1000::Context, Builtin::number, Builtin::number); |
1697 + | 1721 + |
1698 + // Keep a backref to The context since it's going to be needed for of | 1722 + // Keep a backref to The context since it's going to be needed for of |
1699 + // operations involving the ethernet device, flags on the context, etc. | 1723 + // operations involving the ethernet device, flags on the context, etc. |
1700 + attribute Context.ref hw_ctx; | 1724 + attribute Context.ref hw_ctx; |
1701 + | |
1702 + attribute DMA::DMAHandle.scalar dma; | 1725 + attribute DMA::DMAHandle.scalar dma; |
1703 + attribute Builtin::number.scalar size; // Total size in bytes | 1726 + attribute Builtin::number.scalar size; // Total size in bytes |
1704 + attribute Builtin::symbol.ref descs; | 1727 + attribute Builtin::symbol.ref descs; |
1705 + attribute Buffer.ref buffs; | 1728 + attribute Buffer.ref buffs; |
1706 } | 1729 } |
1747 - attribute RxRing.scalar rx_ring; | 1770 - attribute RxRing.scalar rx_ring; |
1748 - /* XXX: circular dependency with Contex: */ | 1771 - /* XXX: circular dependency with Contex: */ |
1749 - //attribute TxRing.scalar tx_ring; | 1772 - //attribute TxRing.scalar tx_ring; |
1750 + attribute RxDescriptor.scalar descs; | 1773 + attribute RxDescriptor.scalar descs; |
1751 + attribute Builtin::number.scalar desc_size; | 1774 + attribute Builtin::number.scalar desc_size; |
1775 + attribute Buffer.ref buffs; | |
1752 } | 1776 } |
1753 | 1777 |
1754 provided type TxRing | 1778 provided type TxRing |
1755 { | 1779 { |
1756 + decl data_types(); | 1780 + decl data_types(); |
1862 + attribute Context.ref hw_ctx; | 1886 + attribute Context.ref hw_ctx; |
1863 + attribute DMA::DMAHandle.scalar dma; | 1887 + attribute DMA::DMAHandle.scalar dma; |
1864 + attribute Builtin::number.scalar size; | 1888 + attribute Builtin::number.scalar size; |
1865 + attribute TxDescriptor.scalar descs; | 1889 + attribute TxDescriptor.scalar descs; |
1866 + attribute Builtin::number.scalar desc_size; | 1890 + attribute Builtin::number.scalar desc_size; |
1891 + attribute Buffer.ref buffs; | |
1867 } | 1892 } |
1868 } | 1893 } |
1869 diff --git a/rathaxes/samples/e1000/ethernet.blt b/rathaxes/samples/e1000/ethernet.blt | 1894 diff --git a/rathaxes/samples/e1000/ethernet.blt b/rathaxes/samples/e1000/ethernet.blt |
1870 --- a/rathaxes/samples/e1000/ethernet.blt | 1895 --- a/rathaxes/samples/e1000/ethernet.blt |
1871 +++ b/rathaxes/samples/e1000/ethernet.blt | 1896 +++ b/rathaxes/samples/e1000/ethernet.blt |